Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: sys.col
Hello.
>im real new and this is a course assignment question i cant figure out.
>i need to mimic the desc statement on a table using sys.col. I can get
>the info ok but it doesnt read well( wraps). is there any way to
>format the output for the follwoing like desc tablename?
It looks like a homework.
> select cname,nulls,coltype,width from sys.com where tname = 'TITLES';
SET PAGES 300 SELECT
RPAD(cname,30,' ') "Name", RPAD(DECODE(nulls,'NULL','',nulls),8,' ') "Null?", RPAD(coltype||DECODE(coltype,'DATE','','('||
DECODE(coltype,'NUMBER',NVL(PRECISION,width),width)||DECODE(scale,0,')',NULL
,')',','||scale||')')),30,' ') "Type"
FROM sys.COL
WHERE tname = 'TITLES';
This is 'close' solution. Had only 15 minutes...
Please take closer look at:
RPAD(), DECODE() and NVL() functions.
Tell Us what did you find out ;-)
-- TomekBReceived on Mon May 24 2004 - 05:58:08 CDT