Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show value from DATA_DEFAULT field 1

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,529
US
ALL_TAB_COLUMNS (or USER_TAB_COLUMNS) describes the columns of the tables, views, etc.

I know my TABLE_NAME and COLUMN_NAME and the default value for that field is a character 'A'

When I do:[tt]
SELECT DATA_DEFAULT
FROM [blue]USER_TAB_COLUMNS[/blue]
WHERE TABLE_NAME = 'MyTable'
AND COLUMN_NAME = 'MyColumn'[/tt]

or
[tt]
SELECT DATA_DEFAULT
FROM [blue]ALL_TAB_COLUMNS[/blue]
WHERE TABLE_NAME = 'MyTable'
AND COLUMN_NAME = 'MyColumn'[/tt]

I do not see the default character 'A', I see (in TOAD):
def_d8tg5c.png


I can double click on (WIDEMEMO) (whatever that is) and I can see the default value for that column:
def1_ocvcpx.png


What would be the SQL to get the 'A' (the actual default value) of the field in my table?

[tt]SELECT [red]WHAT?[/red]
FROM ALL_TAB_COLUMNS
WHERE TABLE_NAME = 'MyTable'
AND COLUMN_NAME = 'MyColumn'[/tt]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
That sounds like TOAD is thwarting you with the (WIDEMEMO) entry.
DATA_DEFAULT is the correct column, but it appears your tool is hindering you. Try the same query using SQL*PLUS in text mode and you may get better results.
Unfortunately, data_default is a LONG datatype and those can be difficult to deal with.
 
Thanks carp!
Yes, TOAD was messing up my output :-(
When I did it in my code, everything is working just fine :)

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top