Home » Other » Client Tools » Describe command
Describe command [message #569298] Wed, 24 October 2012 08:33 Go to next message
helenj
Messages: 3
Registered: October 2012
Junior Member
Hi

I am using Oracle SQL developer and am new to the whole thing unfortunately. I have some SAS code that I would like to translate, but I have fallen at the first hurdle!

I would like to output the contents of a table into a new table, in SAS I have used proc contents ... out=... ;

I have learnt today that the describe command is very useful, and gives me the information I need, but I can't work out how to get that information into a new table.

Any help would be greatly appreciated!

[Updated on: Wed, 24 October 2012 08:34]

Report message to a moderator

Re: Describe command [message #569299 is a reply to message #569298] Wed, 24 October 2012 08:41 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
INSERT INTO NEW_TABLE SELECT * FROM OLD_TABLE;

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: Describe command [message #569300 is a reply to message #569299] Wed, 24 October 2012 09:08 Go to previous messageGo to next message
helenj
Messages: 3
Registered: October 2012
Junior Member
Hi BlackSwan

Thanks for your reply. My original post was not clear enough, it is the desription of the table which I want to export. i.e. for the command

describe table1;

I would like to export the output from this into a new table with 3 variables; New, Null, Tyoe.

Thanks.
Re: Describe command [message #569301 is a reply to message #569300] Wed, 24 October 2012 09:12 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
CREATE TABLE NEW_TABLE AS SELECT * FROM OLD_TABLE WHERE 1 = 2;

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: Describe command [message #569303 is a reply to message #569301] Wed, 24 October 2012 09:42 Go to previous messageGo to next message
helenj
Messages: 3
Registered: October 2012
Junior Member
I am running the query

desribe table1;

which gives the output:

Name Null Type
Var1 Not Null Number(3)
...
...
...



What I would like to do is turn this into a table rather than an output in the results window. So I would end up with a table that contains the output which I have dhown above.
Re: Describe command [message #569304 is a reply to message #569303] Wed, 24 October 2012 10:03 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
All the information in DESCRIBE command (and more) are in ALL_TAB_COLUMNS view.

Regards
Michel
Previous Topic: need help to setup oracle for my course practice..
Next Topic: How to query a tablename that don't exist and not get an error
Goto Forum:
  


Current Time: Thu Mar 28 13:18:16 CDT 2024