CREATE OR REPLACE TRIGGER trLIC_DOCCOUNT
AFTER
INSERT OR
DELETE
FOR EACH ROW
ON fkp_attib
BEGIN
-- Structure of LIC_DOCCOUNT Table:
-- CLRID NUMBER(10) NOT NULL,
-- DOC_COUNT INTEGER
-- FKP_VALUE has the value that we need to check for
IF :New.fkp_keyword = 'CLRID' AND :New.fkp_value in (12345, 67890, 654123, 987456) THEN
CASE
WHEN INSERTING THEN
-- this was an insert so insert a new record in LIC_DOCCOUNT
-- if a record with the same CLRID doesn't exist, otherwise,
-- update the record with the CLRID
WHEN DELETING THEN
-- decrement the DOC_COUNT for the record with the CLRID
END CASE;
END IF;
END;
/
select count(*) as DocCount from (
select distinct doc.FKP_FD_RID
from fkp_attib doc, fkp_attib cli
where doc.FKP_FD_RID=cli.FKP_FD_RID
and cli.FKP_KEYWORD='CLRID' and cli.FKP_VALUE = :PID group by doc.FKP_FD_RID
having sum(decode(doc.fkp_keyword||doc.fkp_value,'DISTRIBUTIONINTERNAL',1,0))=0
)
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE