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 (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.