Actually my scenario is somewhat different.....
E.g. let a table
DATE COL1 COL2 COL3 COL4
---------------------------------------------
4-MAR-2006 X Y Z A
5-MAR-2006 X1 Y1 Z1 A1
I WANT TO INSERT DATA INTO A TABLE OF THAT STRUCTURE HAVING DATE AS SAME
COLUMN NAMES IN ONE COLUMN
AND THE COLUMN VALUE IN OTHER COLUMN ...
LIKE BELOW .....
DATE COL_NAME COL_VAL
-----------------------------------
04-MAR-2006 COL1 X
04-MAR-2006 COL2 Y
04-MAR-2006 COL3 Z
04-MAR-2006 COL4 A
05-MAR-2006 COL1 X1
05-MAR-2006 COL2 Y1
05-MAR-2006 COL3 Z1
05-MAR-2006 COL4 A1
THANKS FOR THE REPLIES ...
----Original Message-----
From: Edwards Ed
[mailto:oracledba-ezmlmshield-x5659042.[Email address protected]
Sent: Wednesday, May 31, 2006 6:09 PM
To: LazyDBA Discussion
Subject: RE: Columns as rows
Well, well, well!
It's Hans! hehe. How have you been? Outstanding code!
select case when r = 1 then to_char(deptno)
when r = 2 then dname
when r = 3 then loc
end as cols_as_rows
from dept, (select rownum r from all_objects where rownum <= 3 ) where
deptno = 10 /
Thanks for the info!
Have a great Day!
Please take a few minutes to provide feedback on the quality of service
you received. The Department of Education values your feedback as a
customer. Commissioner John L. Winn is committed to continuously
assessing and improving the level and quality of services provided to
you by Department staff. Simply use the link below. Thank you in
advance for completing the survey.
http://data.fldoe.org/cs/default.cfm?staff=Ed.[Email address protected]
-----Original Message-----
From: Hans
[mailto:oracledba-ezmlmshield-x93889690.[Email address protected]
Sent: Wednesday, May 31, 2006 8:16 AM
To: LazyDBA Discussion
Subject: RE: Columns as rows
SQL> desc dept
Naam Null? Type
------------------------------------------------------ --------
-------------
DEPTNO
NUMBER(2)
DNAME
VARCHAR2(14)
LOC
VARCHAR2(20)
SQL>select decode( r, 1, to_char(deptno), 2, dname, 3, loc )
2 from dept, (select rownum r from all_objects where rownum <= 3 )
3 where deptno = 10
SQL>/
DECODE(R,1,TO_CHAR(DEPTNO),2,DNAME,3,LOC
----------------------------------------
10
ACCOUNTING
NEW YORK
3 rijen zijn geselecteerd.
SQL>
-----Original Message-----
From: gurjinder
[mailto:oracledba-ezmlmshield-x4282670.[Email address protected]
Sent: woensdag 31 mei 2006 12:05
To: LazyDBA Discussion
Subject: Columns as rows
Hi Gurus,
Is there any one who knows how to insert columns as rows in another
table...
Rgds
Gurjinder
The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.
www.wipro.com
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
-----------------------------------------------------------------
ATTENTION:
The information in this electronic mail message is private and
confidential, and only intended for the addressee. Should you
receive this message by mistake, you are hereby notified that
any disclosure, reproduction, distribution or use of this
message is strictly prohibited. Please inform the sender by
reply transmission and delete the message without copying or
opening it.
Messages and attachments are scanned for all viruses known.
If this message contains password-protected attachments, the
files have NOT been scanned for viruses by the ING mail domain.
Always scan attachments before opening them.
-----------------------------------------------------------------
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
Oracle LazyDBA home page