Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Posts
    9

    Unanswered: How to get all columns only of a table in Oracle?

    Dear all,

    I have 2 questions that need your kind help.

    1. In MySQL, we can use:

    show columns from tableName

    to show all columns.

    How to do it in Oracle?

    I used desc tableName, but it show Type and Nullable as well. Here I only need the column names as return, since I want to use it in Java Resultset to process it.


    2. BTW, in MySQL, we use:

    show databases

    to show all the databases

    what is the corresponding SQL in Oracle?


    Thanks!

  2. #2
    Join Date
    Nov 2002
    Posts
    833
    I know of no such command , but you can retrieve the column_names
    from all_tab_columns...

    select column_name from all_tab_columns where table_name = <table_name> order by column_id ...

  3. #3
    Join Date
    Nov 2002
    Posts
    833
    as for you second question:

    do you mean tablespace or instances ...

    as for instances look at the tnsnames.ora and listener.ora files

    otherwise look at dba_tablespaces

  4. #4
    Join Date
    Apr 2003
    Location
    Jagdishpur
    Posts
    146

    Re: How to get all columns only of a table in Oracle?

    Originally posted by Richard2003
    Dear all,

    I have 2 questions that need your kind help.

    1. In MySQL, we can use:

    show columns from tableName

    to show all columns.

    How to do it in Oracle?

    I used desc tableName, but it show Type and Nullable as well. Here I only need the column names as return, since I want to use it in Java Resultset to process it.


    2. BTW, in MySQL, we use:

    show databases

    to show all the databases

    what is the corresponding SQL in Oracle?


    Thanks!
    Hi,
    For you query No.1, You can use SYSTEM view for the tables in your current schema. The View name is "USER_TAB_COLUMS" . Pass the table name in your query & get the details about the columns.

    Query No.2: There is nothing like different databases in Oracle like we use to have in SYbase. Here, in oracle, architecture is different. Here we have one database INstance & that u can treat it as Sybase Server sort of thing.
    And we have different tablespaces in Oracle whcih u may understand like database in Sybase. So, for deatils about tablespaces, you may user SYSTEM view "USERs_TABLESPACE"

    Hope, it will be helpful to you. See one thing, In Oracle virtually every thing is possible what we used to do it for SQL etc. Here, Check for SYSTEM Views & this gives good info. about all in Oracle.

    Bye,
    - KR

Posting Permissions

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