Try this select statement: select ID, P1||' '||PVAL1 FROM t WHERE ID = 101 UNION select ID, P2||' '||PVAL2 FROM t WHERE ID = 101 UNION select ID, P3||' '||PVAL3 FROM t WHERE ID = 101 select ID, P1||' '||PVAL1 FROM t WHERE ID = 102 UNION select ID, P3||' '||PVAL3 FROM t WHERE ID = 102 UNION select ID, P2||' '||PVAL2 FROM t WHERE ID = 102 UNION select ID, P1||' '||PVAL1 FROM t WHERE ID = 103 UNION select ID, P3||' '||PVAL3 FROM t WHERE ID = 103 UNION select ID, P2||' '||PVAL2 FROM t WHERE ID = 103
--- Nirmal Kumar Muthu Kumaran <[EMAIL PROTECTED]> wrote: > Hi gurus, > > My table data looks like as follows: > > [EMAIL PROTECTED]> select * from t; > > ID P1 PVAL1 P2 PVAL2 > P3 PVAL3 > -------- - -------------------- - > -------------------- - > -------------------- > 101 A VALUE A B VALUE B > C VALUE C > 102 X VALUE X Y VALUE Y > Z VALUE Z > 103 P VALUE P Q VALUE Q > R VALUE R > > [EMAIL PROTECTED]> > > Tab Description: > [EMAIL PROTECTED]> desc t; > Name Null? Type > ------------------------------- -------- ---- > ID NUMBER > PCD1 CHAR(1) > PVAL1 > VARCHAR2(20) > PCD2 CHAR(1) > PVAL2 > VARCHAR2(20) > PCD3 CHAR(1) > PVAL3 > VARCHAR2(20) > > I need output as like: > > ID Pcd PVAL > 101 A VALUE A > 101 B VALUE B > 101 C VALUE C > 102 X VALUE X > 102 Z VALUE Z > 102 Y VALUE Y > 103 P VALUE P > 103 R VALUE R > 103 Q VALUE Q > > Anyone have any idea .... pls. > > Rgds, > Nirmal. > > > -- > Please see the official ORACLE-L FAQ: > http://www.orafaq.com > -- > Author: Nirmal Kumar Muthu Kumaran > INET: [EMAIL PROTECTED] > > Fat City Network Services -- (858) 538-5051 FAX: > (858) 538-5051 > San Diego, California -- Public Internet > access / Mailing Lists > -------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an > E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > the message BODY, include a line containing: UNSUB > ORACLE-L > (or the name of mailing list you want to be removed > from). You may > also send the HELP command for other information > (like subscribing). __________________________________________________ Do You Yahoo!? Listen to your Yahoo! Mail messages from any phone. http://phone.yahoo.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: ASHRAF SALAYMEH INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
