procedure insertValpakCatsMapping(op_company_id IN DISCOUNT_OWNER.COMP_VALPAK_CAT.COMPANYID%type,
op_category_ids IN common.idlist,
op_user_id IN DISCOUNT_OWNER.COMP_VALPAK_CAT.ADD_BY_USERID%type)IS
begin
delete from discount_owner.COMP_VALPAK_CAT where COMPANYID = op_company_id;
insert into discount_owner.COMP_VALPAK_CAT
(companyid,
VALPAK_CATEGORY_ID,
add_by_userid,
change_by_userid)
select op_company_id,
catids.column_value,
op_user_id,
op_user_id
from table(cast(op_category_ids as common.idlist)) catids
minus
select op_company_id,
catids.column_value,
op_user_id,
op_user_id
from discount_owner.COMP_VALPAK_CAT optx, table(cast(op_category_ids as common.idlist)) catids
where optx.companyid = op_company_id and
optx.VALPAK_CATEGORY_ID = catids.column_value;
end;
No comments:
Post a Comment