Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need Sql help

HillbirdSep 23 2011 — edited Sep 23 2011
Greetings to all
Oracle Version:  10gR2

Iam Loading from 2 text files into to different tables, and the result am trying to acheive is either write a insert or select query to get the 
result set as posted below "Expected Output". The idea for writing select i taught was form the output using toad generate the insert script 
and them load back. Let me know if my apprach is wrong.

Create Table Temp1 Values (Id Varcahr2(10), SN archar2(5), RI varchar2(1), POI Varchar2(10));


INSERT INTO TEMP1 Values ('B100', '100', '3', 'XXXXX');
INSERT INTO TEMP1 Values ('B200', '100', '3', 'XXXXX');
INSERT INTO TEMP1 Values ('C100', '100', '3', 'XXXXX');


Create Table temp2 Values (Id Varcahr2(10), SN archar2(5), RI varchar2(1), POI Varchar2(10));

INSERT INTO TEMP1 Values ('B100', '200', '4', 'XXXXX');
INSERT INTO TEMP1 Values ('B100', '300', '4', 'XXXXX');
INSERT INTO TEMP1 Values ('B200', '200', '4', 'XXXXX');

Expected Output

ID	SN	RI	POT
B100    100     3	XXXXX
B100    200     4       XXXXX
B100	300	4	XXXXX
B200    100     3	XXXXX
B200	200	4	XXXXX
C100    100     3	XXXXX 


Am strucked with my approach, can some one help me out. Thanks in advance.

[\Code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
This post has been answered by Frank Kulash on Sep 23 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 21 2011
Added on Sep 23 2011
6 comments
244 views