![Free-eBooks.net](/resources/img/logo-nfe.png)
![All New Design](/resources/img/allnew.png)
In the above, you shall notice Ledger-code has been populated through the database sequence, Here ,NExTVAL increment the value after it has been used whereas if ,currval followed with sequence name will produce the current sequence number and will not get incremented,
THE following trigger can be used for RAAK-TRANS-MASTER CREATE OR REPLACE TRIGGER "RAAK-TRANS-MASTER-BI" BEFORE
INSERT OR UPDATE on "RAAK-TRANS-MASTER" for each row
begin
:NEW."VOUCHER_TYPE : UPPER(:NEW."VOUCHER_TYPE");
:NEW."VOUCHER_NARATION" : UPPER(:NEW."VOUCEHR_NARATION");
if :NEW,"RECORD-ID" IS NULL THEN
:NEW,"RECORD-ID" := RECORD-ID-SEQ,NExTVAL ;
select 'VOU-'IILPAD(VOUCHER-SEQ,NExTVAL,6,'0') into
:NEW,"VOUCHER-NUMBER" from dual; END IF;
end;
The above trigger will help to convert upper case characters for of voucher-type, voucher-naration, Voucher-number will get populated using voucher-Seq created under database obJect, Dot and followed by nextval will increment the sequence number and padded with zeros with a prefix word as 'VOU-', Here vou means voucher,