Describe a columname using the DESC
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: Describe a columname using the DESC

  1. #1
    Join Date
    Jun 2001
    Posts
    3

    Exclamation

    In SQL Plus there is a way to describe a tablename columname. I have been able to describe a particular columname without having to describe a big table.
    Now it gives me a message saying:

    DESC PORTFOLIO END_DATE
    >Usage: DESCRIBE [schema.]object[@db_link]

  2. #2
    Join Date
    Nov 2000
    Location
    Israel
    Posts
    268
    Hi,
    the describe option allows you to describe an object within a specific schema.
    if you want to describe a particular column just perform:

    select column_name,data_type,data_length,nullable from user_tab_columns
    where table_name = 'EMP'
    and column_name = 'ENAME';

    you can put it in a procedure.

  3. #3
    Join Date
    Jun 2001
    Posts
    3
    I know that is a way. But instead of writing the whole thing. You can easily use the desc command to describe the column as well....

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Originally posted by niveditabajaj
    I know that is a way. But instead of writing the whole thing. You can easily use the desc command to describe the column as well....
    Would you care to explain with which tool you could do that? AFAIK in SQL*Plus you were never able to do so, at least not since Oracle6...
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  5. #5
    Join Date
    Jun 2001
    Posts
    3
    I have been able to do it in SQLPlus with Oracle8,8i databases

  6. #6
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Originally posted by niveditabajaj
    I have been able to do it in SQLPlus with Oracle8,8i databases
    This would be news to me. I would be interested if anybody knows if this is possible...
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  7. #7
    Join Date
    Sep 2000
    Location
    Sao Paulo,SP,Brazil, Earth, Milky Way
    Posts
    350
    To be more precise : DESC[RIBE] is a command of SQL*Plus, so its related with the SQL*Plus version : here Im using 2 different SQL*Plus version, conected againts 2 different Oracle 7 versions :

    SQL*Plus: Release 8.1.7.0.0 - Production on Mon Jun 18 15:39:04 2001

    (c) Copyright 2000 Oracle Corporation. All rights reserved.


    Connected to:
    Personal Oracle7 Release 7.3.4.0.0 - Production
    With the distributed, replication and parallel query options
    PL/SQL Release 2.3.4.0.0 - Production

    scott@oracle::SQL>desc emp
    Name Null? Type
    ------------------------------- -------- ----
    EMPNO NOT NULL NUMBER(4)
    ENAME VARCHAR2(10)
    JOB VARCHAR2(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    DEPTNO NUMBER(2)

    scott@oracle::SQL>desc emp ename
    Name Null? Type
    ------------------------------- -------- ----
    ENAME VARCHAR2(10)

    scott@oracle::SQL>

    ==> and against Ora7 server :

    SQL*Plus: Release 3.3.4.0.0 - Production on Mon Jun 18 15:41:38 2001

    Copyright (c) Oracle Corporation 1979, 1996. All rights reserved.

    Connected to:
    Oracle7 Server Release 7.3.4.5.0 - Production
    With the distributed and parallel query options
    PL/SQL Release 2.3.4.5.0 - Production

    SQL> desc emp
    Name Null? Type
    ------------------------------- -------- ----
    EMPNO NOT NULL NUMBER(4)
    ENAME CHAR(10)
    JOB CHAR(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    DEPTNO NOT NULL NUMBER(2)

    SQL> desc emp ename
    Name Null? Type
    ------------------------------- -------- ----
    ENAME CHAR(10)

    SQL>

    Regards,

    Chiappa

  8. #8
    Join Date
    May 2001
    Location
    San Francisco, California
    Posts
    510
    This is not working in Oralce 8.1.7/SQL*PLUS 8.0.5


    SQL> desc dba_users
    Name Null? Type
    ------------------------------- -------- ----
    USERNAME NOT NULL VARCHAR2(30)
    USER_ID NOT NULL NUMBER
    PASSWORD VARCHAR2(30)
    ACCOUNT_STATUS NOT NULL VARCHAR2(32)
    LOCK_DATE DATE
    EXPIRY_DATE DATE
    DEFAULT_TABLESPACE NOT NULL VARCHAR2(30)
    TEMPORARY_TABLESPACE NOT NULL VARCHAR2(30)
    CREATED NOT NULL DATE
    PROFILE NOT NULL VARCHAR2(30)
    INITIAL_RSRC_CONSUMER_GROUP VARCHAR2(30)
    EXTERNAL_NAME VARCHAR2(4000)

    SQL> desc dba_users username
    Usage: DESCRIBE [schema.]object[@db_link]



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width