DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: any one help me?...

  1. #1
    Join Date
    May 2001
    Location
    Dallas, US
    Posts
    78

    Lightbulb any one help me?...

    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
    RP Kumar
    You Can Win, if u believe Yourself

  2. #2
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    Code:
    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

  3. #3
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588
    Code:
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width