The following lines contain the word 'select', 'insert', 'update' or 'delete':
l_sql_trg:= 'CREATE OR REPLACE TRIGGER '||sls_tab||'_TRG AFTER INSERT OR DELETE ON '||sec_tab ||' FOR EACH ROW
DECLARE
l_sec_grp VARCHAR2(30);
SELECT 1
FROM igi_sls_allocations
WHERE sls_group = c_l_sec_grp
AND sls_allocation = '||''''||sec_tab||''''||'
AND date_removed IS NULL ;
SELECT 1
FROM igi_sls_allocations a,igi_sls_allocations b
WHERE a.sls_allocation = b.sls_group
AND a.sls_group = c_l_sec_grp
AND a.sls_group_type = '||'''S'''||'
AND b.sls_group_type = '||'''P'''||'
AND a.sls_allocation_type = '||'''P'''||'
AND b.sls_allocation_type = '||'''T'''||'
AND b.sls_allocation = '||''''||sec_tab||''''||'
AND a.date_removed IS NULL
AND b.date_removed IS NULL;
IF INSERTING THEN
BEGIN
IF SYS_CONTEXT('||'''IGI'''||','||'''SLS_RESPONSIBILITY'''||')='||'''Y'''||' THEN
l_sec_grp:=SYS_CONTEXT('||'''IGI'''||','||'''SLS_SECURITY_GROUP'''||');
INSERT INTO '||l_user||'.'||sls_tab||' (SLS_ROWID, SLS_SEC_GRP)
VALUES(:new.ROWID,l_sec_grp);
END IF; -- Inserting
delete from '||l_user||'.'||sls_tab||' where sls_rowid=:old.rowid;
SELECT 1 FROM igi_sls_security_group_alloc
WHERE table_name = '||''''||sec_tab||''''||'
AND sls_security_group = c_sls_security_group;
d_predicate:='||''' (payment_schedule_id < 0 OR ROWID = (SELECT SLS_ROWID FROM '||sls_tab||' WHERE sls_rowid = '||sec_tab||'.rowid and sls_sec_grp = '||'''||''''''''||l_sls_security_group||''''''''||'''||'))'';
d_predicate:='||''' ROWID = (SELECT SLS_ROWID FROM '||sls_tab||' WHERE sls_rowid = '||sec_tab||'.rowid and sls_sec_grp = '||'''||''''''''||l_sls_security_group||''''''''||'''||')'';
select fpi.application_id
into l_app_id
from fnd_product_installations fpi, fnd_oracle_userid foui
where foui.oracle_id = fpi.oracle_id
and foui.oracle_username = schema_name;
l_sql_trg:= 'CREATE OR REPLACE TRIGGER '||sls_tab||'_TRG BEFORE INSERT OR DELETE ON '||sec_tab ||' FOR EACH ROW
DECLARE
l_sec_grp VARCHAR2(30);
SELECT 1
FROM igi_sls_allocations
WHERE sls_group = c_l_sec_grp
AND sls_allocation = '||''''||sec_tab||''''||'
AND date_removed IS NULL ;
SELECT 1
FROM igi_sls_allocations a,igi_sls_allocations b
WHERE a.sls_allocation = b.sls_group
AND a.sls_group = c_l_sec_grp
AND a.sls_group_type = '||'''S'''||'
AND b.sls_group_type = '||'''P'''||'
AND a.sls_allocation_type = '||'''P'''||'
AND b.sls_allocation_type = '||'''T'''||'
AND b.sls_allocation = '||''''||sec_tab||''''||'
AND a.date_removed IS NULL
AND b.date_removed IS NULL;
IF INSERTING THEN
BEGIN
IF SYS_CONTEXT('||'''IGI'''||','||'''SLS_RESPONSIBILITY'''||')='||'''Y'''||' THEN
l_sec_grp:=SYS_CONTEXT('||'''IGI'''||','||'''SLS_SECURITY_GROUP'''||');
END IF; -- If Inserting
delete from '||l_user||'.'||sls_tab||' where sls_rowid=:old.rowid;
SELECT 1
FROM igi_sls_security_group_alloc
WHERE table_name = '||''''||sec_tab||''''||'
AND sls_security_group = c_sls_security_group;