Read structure of a table. / Generate txt file.

Scripts Diversos para o Oracle SQL*Plus. (Relacionado a ferramenta Oracle SQL*Plus, para questões de SQL, usar o forum SQL)
Post Reply
recruta0
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Thu, 19 Mar 2009 2:09 pm
Location: Rio de Janeiro - RJ
R3CRUT4 Z3R0

Guys, I'm new to SQLPlus and the forum as well.
How do I read the structure of a table?
Already with the query ready how to generate a txt file?
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Brother,

Would you need the structure with constraints or, just the fields?

If it is only the fields, take a look at the User_Tab_Columns (or ALL_TAB_COLUNS).

If this needs, give a spool on SQL * Plus of this content.
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Just to see the structure, in SQL * Plus there is the DESC command.
Just put desc and table name.
recruta0
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Thu, 19 Mar 2009 2:09 pm
Location: Rio de Janeiro - RJ
R3CRUT4 Z3R0

Thomas worked. Vlw.
Trevisolli, the 1st OP said there was no selected line and 2nd OP that there was no table.

Thanks staff.
Thank you very much.
I still have much to learn from you.
recruta0
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Thu, 19 Mar 2009 2:09 pm
Location: Rio de Janeiro - RJ
R3CRUT4 Z3R0

And the txt file?
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Is that it is all_tab_columns, the trevis wrote wrong (all_tab_coluns)

on generating the txt, did not work make a spool?
or do you want to make a program that generates file?
recruta0
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Thu, 19 Mar 2009 2:09 pm
Location: Rio de Janeiro - RJ
R3CRUT4 Z3R0

Just generate TXT.

In the case of Spool, set the file, executed the query and the spool command.

SQL> Spool
Unloading spool at the time to test.lst
SQL>

I took time and opened the file with notepad, but remains blank.
recruta0
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Thu, 19 Mar 2009 2:09 pm
Location: Rio de Janeiro - RJ
R3CRUT4 Z3R0

OK. Spool worked.

But the query header repeated several times.
How do I do not happen?
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

SET PAGESIZE 2000

also has
set HEAD OFF
Read about SQL * Plus sets and you will discover a new world!
recruta0
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Thu, 19 Mar 2009 2:09 pm
Location: Rio de Janeiro - RJ
R3CRUT4 Z3R0

Thank you very much.
SDS.
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests