Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: sys.col

Re: sys.col

From: Noel <tomekb_at_softman.pl>
Date: Mon, 24 May 2004 12:58:08 +0200
Message-ID: <c8skf0$5eu$1@inews.gazeta.pl>


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 ;-)

--
TomekB
Received on Mon May 24 2004 - 05:58:08 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US