|
|
发表于 2007/8/3 20:05:35
|
显示全部楼层
Example for Return to Supplier
CREATE SEQUENCE APPS.rcv_transactions_SEQ
START WITH 0
MAXVALUE 999999999
MINVALUE 0
NOCYCLE
NOCACHE
NOORDER;
CREATE OR REPLACE TRIGGER rcv_transactions_trg
BEFORE INSERT
ON rcv_transactions
FOR EACH ROW
DECLARE
seq number;
BEGIN
IF :new.TRANSACTION_TYPE='RETURN TO VENDOR'
THEN
select rcv_transactions_seq.nextval into seq from dual;
:NEW.attribute1 := '<GROUPID>'||to_char(sysdate,'YYYY')||lpad(to_char(seq),5,'0');
END IF;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
--Make return to Vendor in 11i
select creation_date, TRANSACTION_TYPE, attribute1 --RETURN TO VENDOR
from rcv_transactions
where creation_date > sysdate - 1
and attribute1 is not null
CREATION_DATE TRANSACTION_TYPE ATTRIBUTE1
8/3/2007 14:04:34 RETURN TO VENDOR <GROUPID>200700000 |
|