Home » SQL & PL/SQL » SQL & PL/SQL » Pls. suggest the better way to select rows in this scenario (Oracle 10g)
Pls. suggest the better way to select rows in this scenario [message #288319] Mon, 17 December 2007 01:16 Go to next message
hidnana
Messages: 87
Registered: November 2007
Location: chennai
Member
Please let me know which is the better way to select the rows

T1 

SNo	  C1	C2	C3

1	001	NULL	NULL
2	NULL	02	NULL
3	NULL	NULL	03
4	004	NULL	NULL

Other columns in T1 are not shown here

T2

SNo	  C1	C2	C3

1	001	NULL	NULL
2	NULL	02	NULL

Other columns in T2 are not shown here
The records which are in T1 and not in T2  needs to be in T2. 
In this e.g., Sno 3 and 4.


Is it better to go for MINUS and select those rows from T1 or should I do induvidual colmn level comparison against both the tables and arrive at the resulting rows. Which is the better way, also which is better for performance ?
Re: Pls. suggest the better way to select rows in this scenario [message #288324 is a reply to message #288319] Mon, 17 December 2007 01:40 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Use MERGE, it is its purpose.

Regards
Michel
Re: Pls. suggest the better way to select rows in this scenario [message #288358 is a reply to message #288324] Mon, 17 December 2007 04:14 Go to previous message
hidnana
Messages: 87
Registered: November 2007
Location: chennai
Member
Thanks Michael.
Previous Topic: confusion for day of week
Next Topic: scott user
Goto Forum:
  


Current Time: Sat Feb 15 08:41:27 CST 2025