NVL: Replace NULL values

Submitted by:Pitter Alderson

Date added:25 August, 2014

Category:PL SQL

The function NVL replaces null values with a stated value. In this example the rc.customer is assigned the number '0' if it is null.

Tags: nvl , replace value

Code Snippet:

CREATE OR REPLACE VIEW test2
AS
SELECT mdgv.customer_id customer_id,
NVL(rc.customer_number,0) customer_number,
NVL(rc.customer_name,'Unidentified') customer_name,
mdgv.payment_schedule_id payment_schedule_id,
mdgv.trx_number trx_number,
mdgv.trx_date trx_date,
mdgv.due_date due_date,
mdgv.gl_date_closed gl_date_closed,
mdgv.amount amount
FROM test1 mdgv,
ra_customers rc
WHERE mdgv.customer_id = rc.customer_id (+);
 
 

Comments