Re: number of columns in a table?

From: <mlanda_at_vnet.ibm.com>
Date: 1996/08/14
Message-ID: <4usv4b$1glo_at_watnews1.watson.ibm.com>#1/1


In <3210E4A8.41C6_at_curagen.com>, Charlene Liang <cliang_at_curagen.com> writes:
>Hi,
>
>We would like to know if we can get information such as number of
>columns in a table from PL/SQL?
>
>Or if we can loop through dbms_sql.define_column to exhaust all the
>colomns?
>
>Any suggestion is appreciated.
>
>Charlene
>--
>
>Charlene Liang | (203) 481-1104 ext. 287
>CuraGen Corporation |
>322 E. Main St. |
>Branford, CT 06405 |
>cliang_at_curagen.com | (FAX) (203) 481-1102

If all you want is the number of columns for a given table you could use all_tab_columns. For Example:

Procedure Count_cols (Owner_in        in    Varchar2,
                      TableName_in    in    Varchar2,
                      Col_Cnt         Out   Binary_Integer) is
  begin

    select count(column_name)
    into col_cnt
    from all_tab_columns
    where owner=Owner_in and

          table_name=TableName_in;

end Count_Cols;

M.Landa Received on Wed Aug 14 1996 - 00:00:00 CEST

Original text of this message