Oracle SQL, PLSQL, APEX How To's by Dr. S. Raghunathan - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

CREATE OR REPLACE TRIGGER "BI-PROFIT-LOSS" before insert on "PROFIT-LOSS"

for each row begin

if :NEW."RECORD-ID" is null then

 

select "RECORD-ID-SEQ".nextval into :NEW."RECORD-ID" from dual;

end if;

 

end;

 

 

 

 

 

 

 

 

Having created three tables, various constraints, and triggers in different occasion, let us summarize on consolidated sql and lists :

CREATE TABLE "RAAK-LEDGER-MASTER" ( "RECORD-ID" NUMBER,

"LEDGER-CODE" CHAR(l0), "LEDGER-NAME" VARCHAR2(200), "REPORT-TYPE" CHAR(2),

CONSTRAINT "RAAK-LEDGER-MASTER-PK" PRIMARY KEY

 

("RECORD-ID") ENABLE,

 

CONSTRAINT "RAAK-LEDGER-MASTER-CKl" CHECK ( "REPORT-TYPE" IN (IBSI, IPLI)) ENABLE,

CONSTRAINT "RAAK-LEDGER-MASTER-CK2" CHECK ( "LEDGER-NAME" IS NOT NULL) ENABLE

)

 

/

 

 

CREATE TABLE "RAAK-TRANS-MASTER"