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.

Trigger is a database obJect, This trigger can be initiated through APEX Wizards and as well as through sql scripts,

→      Login Apex

 

→      SQL Workshop

 

→      ObJect Browser

 

→      Select Triggers in the left Window

 

→      CREATE

 

→      select the table name RAAK-LEDGER-MASTER

 

→        change the default constraint name as

 

RAAK-LEDGER-MASTER-BI as constraint name

 

→      Firing Point as BEFORE

 

→      Insert against "OPTONS"

 

→      Click Tick FOR EACH ROW

 

→      Leave the when column option as blank

 

→      Write the body as

 

:NEW,"REPORT-TYPE" := UPPER(:NEW,"REPORT-TYPE");

 

:NEW,"LEDGER-NAME" := UPPER(:NEW,"LEDGER-NAME"); IF :NEW,"RECORD-ID" IS NULL THEN

:NEW."RECORD_ID" :- TO_NUMBER(SYS_GUID(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

END IF;

 

→      Click NEXT   →       FINISH

 

This trigger  will generate  system sequence number  and will fill the record-id column, Any letters typed against report-type, ledger-name column will get converted as upper case, Record-id will have unique value even in transferring this table in to another database and it will not get