Hi,
I am trying to insert sample_sender to sample_receiver table
CREATE TABLE sample_sender
(
a_id NUMBER,
b_id NUMBER,
sum_total NUMBER,
sum_toatal2 NUMBER,
code VARCHAR2(6),
default_value NUMBER
);
1)insert into sample_sender values( 10,11,100,120,NULL,NULL);
2)insert into sample_sender values( 10,11,100,120,NULL,1);
4)
CREATE TABLE sample_receiver
(
a_id NUMBER,
b_id NUMBER,
sum_total NUMBER,
sum_toatal2 NUMBER,
code VARCHAR2(6),
default_value NUMBER
);
5)
INSERT INTO sample_receiver
(
a_id ,
b_id ,
sum_total ,
sum_toatal2 ,
code ,
default_value
)
SELECT a.a_id ,
a.b_id ,
a.sum_total ,
a.sum_toatal2 ,
a.code ,
a.default_value
FROM sample_sender a
WHERE NOT EXISTS
(
SELECT 1 FRoM sample_receiver b
WHERE a.a_id=b.a_id
AND a.b_id=b.b_id
--AND NVL(a.code,'X')=NVL(b.code,'X')
--AND NVL(a.default_value,-1)=NVL(b.default_value,-1)
);
First i used 1st insert command
so my sample_sender table has 1 row and my sample_receiver table also 1 row
and again tried to inserted with 2nd insert command so my sample_sender table has 2 rows and my sample_receiver table only 1 row that is Exist row
So that's why we can used NVL , But i want to know the how it NVL is working here?
Thanks
Message was edited by: Rajesh123 Added Extra Message