Click to See Complete Forum and Search --> : any one help me?...


Kumar_RP
12-26-2002, 08:41 AM
create table test1(acctno varchar2(10), col1 number(5,2), col2 number(5,2), col3 number(5,2));

insert into test1 values('aaa',1,2,3);

insert into test1 values('bbb',4,5,6);

insert into test1 values('ccc',7,8,9);


select * from test1;

acctno col1 col2 col3
--------------------------------------------
aaa 1 2 3
bbb 4 5 6
ccc 7 8 9



i need to output as


aaa col1 1
col2 2
col3 3
bbb col1 4
col2 5
col3 6
ccc col1 7
col2 8
col3 9


the query should be in optimized one..?>...


Thanks

Shestakov
12-26-2002, 12:24 PM
SQL> select object_id,
object_name||chr(10)||owner||chr(10)||object_type name
from all_objects where rownum < 5;

OBJECT_ID NAME
---------- --------------------------------------------------------------------------------
89 ACCESS$
SYS
TABLE

1290 ALL_ALL_TABLES
SYS
VIEW

1251 ALL_ARGUMENTS
SYS
VIEW

1513 ALL_ASSOCIATIONS
SYS
VIEW

Sameer
12-27-2002, 04:30 AM
SQL> BREAK ON acctno
SQL> SELECT acctno||' col1 '||col1||chr(10)||'col2 '||col2||chr(10)||'col3 '||col3
2 as tab_contents FROM test1;

TAB_CONTENTS
--------------------------------------------------------------------------------
aaa col1 1
col2 2
col3 3

bbb col1 4
col2 5
col3 6

ccc col1 7
col2 8
col3 9