Subject | How to call stored procedure from trigger |
---|---|
Author | Rick DeBay |
Post date | 2004-12-29T19:21:36Z |
How do I correct the following trigger? It's complaining about the
EXECUTE PROCEDURE part.
DECLARE VARIABLE PO_ID BIGINT;
DECLARE VARIABLE INV_ID BIGINT;
begin
/* create new/find existing PO and invoice */
PO_ID = EXECUTE PROCEDURE P_CREATE_PO(NEW.PO, NEW.DIST_CTR,
NEW.NABPNUM, NEW.GRANTEE, NEW.SUBMITTED);
INV_ID = EXECUTE PROCEDURE P_CREATE_INVOICE(NEW.PO, NEW.INVOICE);
/* create order-item record */
INSERT INTO ORDER_ITEM(PURCH_ORDER, NDC, QTY, INVOICE, DIST_CTR,
STATUS, STATUS_CHNG)
VALUES (:PO_ID, COALESCE(NEW.NDC_SUB, NEW.NDC),
COALESCE(NEW.QTY_SHIP_SUB, NEW.QTY_SHIPPED), :PO_ID, NEW.DIST_CTR, 'O',
NEW.SUBMITTED);
end
Rick DeBay
Senior Software Developer
RxStrategies.net
EXECUTE PROCEDURE part.
DECLARE VARIABLE PO_ID BIGINT;
DECLARE VARIABLE INV_ID BIGINT;
begin
/* create new/find existing PO and invoice */
PO_ID = EXECUTE PROCEDURE P_CREATE_PO(NEW.PO, NEW.DIST_CTR,
NEW.NABPNUM, NEW.GRANTEE, NEW.SUBMITTED);
INV_ID = EXECUTE PROCEDURE P_CREATE_INVOICE(NEW.PO, NEW.INVOICE);
/* create order-item record */
INSERT INTO ORDER_ITEM(PURCH_ORDER, NDC, QTY, INVOICE, DIST_CTR,
STATUS, STATUS_CHNG)
VALUES (:PO_ID, COALESCE(NEW.NDC_SUB, NEW.NDC),
COALESCE(NEW.QTY_SHIP_SUB, NEW.QTY_SHIPPED), :PO_ID, NEW.DIST_CTR, 'O',
NEW.SUBMITTED);
end
Rick DeBay
Senior Software Developer
RxStrategies.net