The following lines contain the word 'select', 'insert', 'update' or 'delete':
|This is primarily used for the triggers of mtl tables to update the
|IBE_CT_IMEDIA_SEARCH table .
|
|MTL_ITEM_CATEGORIES
|1) insert ,
|2) delete
|not sure if direct updates take place here
|
|MTL_SYSTEM_ITEMS_B
|dont care about its update as we are not using any of its columns right now
|Although we could just write the inset update delete on its tl table we
|still decided to write the delete on it :-)
|
|
|
| HISTORY
| 12-15-99 Savio T Created.
| 10-16-03 abhandar modified bug fix 3168087:catalog search performance
| 04-16-08 mgiridha bug 6924793 ITEMS NOT SEARCHABLE BY PART NUMBER AFTER REPUBLISHING ON ISTORE.
+=======================================================================*/
-----------------------------------------------
--PROCEDURE CALLED ON INSERT IN ITEM CATEGORIES
--HERE YOU NEED TO INSERT A NEW ROW INTO IMEDIA_SEARCH TABLE
--added on 04/18 code to join on mtl_system_items_b
--table to get web status flag over
-----------------------------------------------
procedure Item_Category_Inserted(
new_category_id number,
new_category_set_id number,
new_inventory_item_id number,
new_organization_id number)
is
l_insert_flag boolean:=false;
l_insert_flag := TRUE;
l_insert_flag := FALSE;
l_insert_flag := TRUE;
IF (l_insert_flag) THEN
--dbms_output.put_line('l_insert_flag=true');
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
new_category_id , new_organization_id ,
new_inventory_item_id, b.LANGUAGE,
b.DESCRIPTION, b.LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(b.description , b.long_description ,c.concatenated_segments),
new_category_set_id , a.web_status
from mtl_system_items_b a ,mtl_system_items_tl b ,mtl_system_items_kfv c
where b.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and b.organization_id = a.organization_id
and b.INVENTORY_ITEM_ID = new_inventory_item_id
and b.ORGANIZATION_ID = new_organization_id
and a.INVENTORY_ITEM_ID = c.INVENTORY_ITEM_ID
and a.ORGANIZATION_ID = c.organization_id
and a.web_status = 'PUBLISHED';
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
new_category_id , new_organization_id ,
new_inventory_item_id, b.LANGUAGE,
b.DESCRIPTION, b.LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(b.description, b.long_description ,c.concatenated_segments),
new_category_set_id , a.web_status
from mtl_system_items_b a ,mtl_system_items_tl b ,mtl_system_items_kfv c
where b.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and b.organization_id = a.organization_id
and b.INVENTORY_ITEM_ID = new_inventory_item_id
and b.ORGANIZATION_ID = new_organization_id
and a.INVENTORY_ITEM_ID = c.INVENTORY_ITEM_ID
and a.ORGANIZATION_ID = c.organization_id
and a.web_status IN ('PUBLISHED', 'UNPUBLISHED');
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
new_category_id , new_organization_id ,
new_inventory_item_id, b.LANGUAGE,
b.DESCRIPTION, b.LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(b.description , b.long_description ,c.concatenated_segments),
new_category_set_id , a.web_status
from mtl_system_items_b a ,mtl_system_items_tl b ,mtl_system_items_kfv c
where b.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and b.organization_id = a.organization_id
and b.INVENTORY_ITEM_ID = new_inventory_item_id
and b.ORGANIZATION_ID = new_organization_id
and a.INVENTORY_ITEM_ID = c.INVENTORY_ITEM_ID
and a.ORGANIZATION_ID = c.organization_id;
END Item_Category_Inserted;
procedure Item_Category_Deleted(
old_category_id number,
old_category_set_id number,
old_inventory_item_id number,
old_organization_id number)
is
begin
delete from ibe_ct_imedia_search c
where c.CATEGORY_ID = old_category_id
and c.CATEGORY_SET_ID = old_category_set_id
and c.INVENTORY_ITEM_ID = old_inventory_item_id
and c.ORGANIZATION_ID = old_organization_id ;
end Item_Category_Deleted;
procedure Item_Category_Updated(
old_category_id number,new_category_id number,
old_category_set_id number,new_category_set_id number,
old_inventory_item_id number,new_inventory_item_id number,
old_organization_id number,new_organization_id number)
is
l_search_category_set VARCHAR2(30);
select 1 from mtl_system_items_b item
where item.inventory_item_id =c_inventory_item_id
and item.organization_id=c_organization_id
and item.web_status='PUBLISHED' and
exists (select 1 from ibe_dsp_section_items sec_item
where sec_item.inventory_item_id=item.inventory_item_id
and organization_id=item.organization_id);
update ibe_ct_imedia_search c
set CATEGORY_ID = new_category_id,
CATEGORY_SET_ID = new_category_set_id,
LAST_UPDATE_DATE = sysdate,
INVENTORY_ITEM_ID = new_inventory_item_id,
ORGANIZATION_ID = new_organization_id
where c.CATEGORY_ID = old_category_id
AND c.CATEGORY_SET_ID = old_category_set_id
AND c.INVENTORY_ITEM_ID = old_inventory_item_id
AND c.ORGANIZATION_ID = old_organization_id;
update ibe_ct_imedia_search c
set CATEGORY_ID = new_category_id,
CATEGORY_SET_ID = new_category_set_id,
LAST_UPDATE_DATE = sysdate,
INVENTORY_ITEM_ID = new_inventory_item_id,
ORGANIZATION_ID = new_organization_id
where c.CATEGORY_ID = old_category_id
AND c.CATEGORY_SET_ID = old_category_set_id
AND c.INVENTORY_ITEM_ID = old_inventory_item_id
AND c.ORGANIZATION_ID = old_organization_id;
update ibe_ct_imedia_search c
set CATEGORY_ID = new_category_id,
CATEGORY_SET_ID = new_category_set_id,
LAST_UPDATE_DATE = sysdate,
INVENTORY_ITEM_ID = new_inventory_item_id,
ORGANIZATION_ID = new_organization_id
where c.CATEGORY_ID = old_category_id
AND c.CATEGORY_SET_ID = old_category_set_id
AND c.INVENTORY_ITEM_ID= old_inventory_item_id
AND c.ORGANIZATION_ID = old_organization_id;
DELETE ibe_ct_imedia_search where
CATEGORY_ID = old_category_id
AND CATEGORY_SET_ID = old_category_set_id
AND INVENTORY_ITEM_ID = old_inventory_item_id
AND ORGANIZATION_ID = old_organization_id;
DELETE ibe_ct_imedia_search where
CATEGORY_ID = old_category_id
AND CATEGORY_SET_ID = old_category_set_id
AND INVENTORY_ITEM_ID = old_inventory_item_id
AND ORGANIZATION_ID = old_organization_id;
select web_status into l_web_status from mtl_system_items_b
where inventory_item_id=new_inventory_item_id and organization_id= new_organization_id;
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
new_category_id , new_organization_id ,
new_inventory_item_id, b.LANGUAGE,
b.DESCRIPTION, b.LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(b.description , b.long_description ,c.concatenated_segments),
new_category_set_id , a.web_status
from mtl_system_items_b a ,mtl_system_items_tl b ,mtl_system_items_kfv c
where b.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and b.organization_id = a.organization_id
and b.INVENTORY_ITEM_ID = new_inventory_item_id
and b.ORGANIZATION_ID = new_organization_id
and a.INVENTORY_ITEM_ID = c.INVENTORY_ITEM_ID
and a.ORGANIZATION_ID = c.organization_id;
END Item_Category_Updated;
procedure Item_Deleted(
old_inventory_item_id number,
old_organization_id number)
is
begin
delete from ibe_ct_imedia_search c
where c.INVENTORY_ITEM_ID = old_inventory_item_id
and c.ORGANIZATION_ID = old_organization_id ;
end Item_Deleted ;
select 1 into l_item_exists_count from mtl_item_categories
where inventory_item_id = p_inventory_item_id and
organization_id= p_organization_id and category_set_id=l_search_category_set
and rownum=1;
select 1 into l_item_exists_count from mtl_item_categories
where inventory_item_id = p_inventory_item_id and
organization_id= p_organization_id and rownum=1;
procedure Item_Updated(
old_inventory_item_id number,
old_organization_id number,
old_web_status varchar2,
new_web_status varchar2)
is
l_search_web_status VARCHAR2(30);
update ibe_ct_imedia_search
set web_status = new_web_status
where inventory_item_id = old_inventory_item_id
and organization_id = old_organization_id;
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
d.category_id , old_organization_id ,
old_inventory_item_id, b.LANGUAGE,
b.DESCRIPTION, b.LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(b.description , b.long_description ,a.concatenated_segments),
d.category_set_id , new_web_status
from mtl_system_items_tl b ,mtl_item_categories d, mtl_system_items_b_kfv a
where b.INVENTORY_ITEM_ID = old_inventory_item_id
and b.ORGANIZATION_ID = old_organization_id
and b.INVENTORY_ITEM_ID = d.INVENTORY_ITEM_ID
and b.organization_id = d.organization_id
and d.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and d.organization_id = a.organization_id;
update ibe_ct_imedia_search
set web_status = new_web_status
where inventory_item_id = old_inventory_item_id
AND organization_id = old_organization_id;
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
d.category_id , old_organization_id ,
old_inventory_item_id, b.LANGUAGE,
b.DESCRIPTION, b.LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(b.description , b.long_description ,a.concatenated_segments),
d.category_set_id , new_web_status
from mtl_system_items_tl b ,mtl_item_categories d, mtl_system_items_b_kfv a
where b.INVENTORY_ITEM_ID = old_inventory_item_id
and b.ORGANIZATION_ID = old_organization_id
and b.INVENTORY_ITEM_ID = d.INVENTORY_ITEM_ID
and b.organization_id = d.organization_id
and d.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and d.organization_id = a.organization_id;
Delete from ibe_ct_imedia_search
where INVENTORY_ITEM_ID = old_inventory_item_id
and ORGANIZATION_ID = old_organization_id;
end Item_Updated;
procedure ItemTL_Deleted(
old_inventory_item_id number,
old_organization_id number,
old_language varchar2)
is
begin
delete from ibe_ct_imedia_search c
where c.INVENTORY_ITEM_ID = old_inventory_item_id
and c.LANGUAGE = old_language
and c.ORGANIZATION_ID = old_organization_id ;
end ItemTL_Deleted;
procedure ItemTL_Updated(
old_inventory_item_id number,
old_organization_id number,
old_language varchar2,
new_language varchar2,
new_description varchar2,
new_long_description varchar2
)
is
begin
update IBE_CT_IMEDIA_SEARCH g
set
g.language = new_language ,
g.LAST_UPDATE_DATE = sysdate ,
g.DESCRIPTION = new_description ,
g.LONG_DESCRIPTION = new_long_description ,
g.INDEXED_SEARCH = (select ibe_search_setup_pvt.WriteToLob(new_description , new_long_description,a.concatenated_segments)
from mtl_system_items_kfv a
where a.inventory_item_id = old_inventory_item_id
and a.organization_id = old_organization_id
)
where g.INVENTORY_ITEM_ID = old_inventory_item_id
AND g.organization_id = old_organization_id
AND g.language = old_language ;
end ItemTL_Updated;
procedure ItemTL_Inserted(
new_inventory_item_id number,
new_organization_id number,
new_language varchar2,
new_description varchar2,
new_long_description varchar2
)
is
l_search_category_set varchar2(30);
l_insert_flag boolean :=false;
select 1 from mtl_system_items_b item
where item.inventory_item_id =c_inventory_item_id
and item.organization_id=c_organization_id
and item.web_status='PUBLISHED' and
exists (select 1 from ibe_dsp_section_items sec_item
where sec_item.inventory_item_id=item.inventory_item_id
and organization_id=item.organization_id);
l_insert_flag := FALSE;
l_insert_flag := TRUE;
l_insert_flag:=TRUE;
l_insert_flag:=FALSE;
l_insert_flag:= FALSE;
l_insert_flag := TRUE;
IF (l_insert_flag) THEN
----dbms_output.put_line('l_insert_flag=true');
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
c.category_id , new_organization_id ,
new_inventory_item_id, new_LANGUAGE,
new_DESCRIPTION, new_LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(new_description , new_long_description ,a.concatenated_segments),
c.category_set_id , b.web_status
from mtl_system_items_kfv a, mtl_system_items_b b, mtl_item_categories c
where b.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and b.organization_id = a.organization_id
and b.INVENTORY_ITEM_ID = new_inventory_item_id
and b.ORGANIZATION_ID = new_organization_id
and a.INVENTORY_ITEM_ID = c.INVENTORY_ITEM_ID
and a.ORGANIZATION_ID = c.organization_id
and b.web_status = 'PUBLISHED';
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
c.category_id , new_organization_id ,
new_inventory_item_id, new_LANGUAGE,
new_DESCRIPTION, new_LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(new_description , new_long_description ,a.concatenated_segments),
c.category_set_id , b.web_status
from mtl_system_items_kfv a, mtl_system_items_b b, mtl_item_categories c
where b.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and b.organization_id = a.organization_id
and b.INVENTORY_ITEM_ID = new_inventory_item_id
and b.ORGANIZATION_ID = new_organization_id
and a.INVENTORY_ITEM_ID = c.INVENTORY_ITEM_ID
and a.ORGANIZATION_ID = c.organization_id
and b.web_status IN ('PUBLISHED', 'UNPUBLISHED');
insert into ibe_ct_imedia_search (IBE_CT_IMEDIA_SEARCH_ID
, OBJECT_VERSION_NUMBER, CREATED_BY, CREATION_DATE
, LAST_UPDATED_BY, LAST_UPDATE_DATE, LAST_UPDATE_LOGIN
, CATEGORY_ID, ORGANIZATION_ID, INVENTORY_ITEM_ID
, LANGUAGE, DESCRIPTION, LONG_DESCRIPTION, INDEXED_SEARCH
, CATEGORY_SET_ID, WEB_STATUS)
SELECT
ibe_ct_imedia_search_s1.nextval,
0, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.user_id,
SYSDATE, FND_GLOBAL.conc_login_id,
c.category_id , new_organization_id ,
new_inventory_item_id, new_LANGUAGE,
new_DESCRIPTION, new_LONG_DESCRIPTION,
ibe_search_setup_pvt.WriteToLob(new_description , new_long_description ,a.concatenated_segments),
c.category_set_id , b.web_status
from mtl_system_items_kfv a, mtl_system_items_b b, mtl_item_categories c
where b.INVENTORY_ITEM_ID = a.INVENTORY_ITEM_ID
and b.organization_id = a.organization_id
and b.INVENTORY_ITEM_ID = new_inventory_item_id
and b.ORGANIZATION_ID = new_organization_id
and a.INVENTORY_ITEM_ID = c.INVENTORY_ITEM_ID
and a.ORGANIZATION_ID = c.organization_id;
end ItemTL_Inserted;