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.

compare null column with some other data, you shall give assumption value through one function command, For example If you want to write

as Irecord-id = 1 then

 

In this case if record-id value is null then this comparison fails instead of that the following syntax may be used "if NVL(record_id, 0 )     1 then". Here NVL function takes a role if the given parameter or column value is null or no data found then that may be replaced as zero,

Hence NVL(  )  is function which will accept two  parameters  such  as column name, field name, variable name, separated by comma and then the required default value may be given as second parameters,

:NEW, On seeing the word, we shall expect :OLD, Also, Generally :NEW, Followed by column name will indicate, new value of column name and

:OLD,column name refers to old value available in the data storage,

 

For example, there is Pay as column name in a table and on particular record it has got 1200, On editing user has replaced this value with 1500,

:OLD.PAY →  1200

 

:NEW,PAY    →      1500

 

another instance: at the time fresh record or on new insert, initial value may be null and then substituted value may be user's value

:OLD,PAY                →                  null

 

:NEW,PAY                →                  1200

 

On this Before Insert Trigger with respect to Raak-Ledger-Master, we have one more requirement such as

→      Even if user enters ledger-name  in lower case letters should be converted as upper case letters, Changes may be made on new record and