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.

correcting the existing records also, Hence this trigger should get fired for converting the data into upper case during insert and update,

→      This conversion applicable for Report Type column too, Very slight modification need to be done on Before Insert Trigger:

 

Before Modification of

 

Trigger

After Modification

 

CREATE OR REPLACE TRIGGER "RAAK_ledger_MASTER_BI" BEFORE

insert on "RAAK_ledger_MASTER" for each row

begin

 

if :NEW."RECORD_ID" IS NULL THEN

:NEW."RECORD_ID" :-

 

 

TO_NUMBER(SYS_GUID()'Ix xxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxI);

END IF;

 

end;

create or replace trigger

 

"RAAK-LEDGER-MASTER-BI" BEFORE

insert on

"RAAK-LEDGER-MASTER" for each row

 

begin

 

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

:NEW,"LEDGER-NAME" := UPPER(:NEW,"LEDGER-NAME"

);

 

select :NEW,"REPORT-TYPE"II'-

 

'IILPAD(LEDGER-SEQ,NEXTVA L,4,'0')II'-00' into

:NEW,"LEDGER-CODE" from dual;

IF :NEW,"RECORD-ID" IS NULL THEN