Home » RDBMS Server » Server Administration » how to count no. of columns in a table??
how to count no. of columns in a table?? [message #373170] Mon, 02 April 2001 07:41 Go to next message
Arjun V
Messages: 14
Registered: March 2001
Junior Member
How to count the number of columns in particular table??
Re: how to count no. of columns in a table?? [message #373172 is a reply to message #373170] Mon, 02 April 2001 08:02 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
HI

Select count(column_name) from user_tab_columns where table_name = 'MYTABLE';
Re: how to count no. of columns in a table?? [message #373175 is a reply to message #373172] Mon, 02 April 2001 08:36 Go to previous messageGo to next message
adelia
Messages: 45
Registered: April 2001
Member
I executed this

select count(COD_BAIRRO) from ALL_tab_columns where table_name ='BAIRRO';

and the error ocurred :
select count(COD_BAIRRO) from ALL_tab_columns where table_name ='BAIRRO'
*
ERROR at line 1:
ORA-00904: invalid column name

U known what is it ?

Thanks

Adélia
Re: how to count no. of columns in a table?? [message #373176 is a reply to message #373172] Mon, 02 April 2001 09:00 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
Hi

column_name here is column_name not yourcolumn_name.

try
either
select count(column_name) from ALL_tab_columns where table_name ='BAIRRO'

or
select count(*) from ALL_tab_columns where table_name ='BAIRRO'
Re: how to count no. of columns in a table?? [message #373177 is a reply to message #373172] Mon, 02 April 2001 09:10 Go to previous messageGo to next message
adelia
Messages: 45
Registered: April 2001
Member
Thanks Bala

select count(column_name) from ALL_tab_columns where table_name ='BAIRRO'

It´s ok !
Re: how to count no. of columns in a table?? [message #373201 is a reply to message #373172] Tue, 03 April 2001 23:18 Go to previous message
Naresh
Messages: 27
Registered: March 2001
Junior Member
In simple terms it means :

The column name entered is either missing or invalid.

Enter a valid column name. See to it that the
column_name entered is there in the table.

Try desc table_name
Previous Topic: how to retrive data starts from Aa till Am from a table?
Next Topic: Partitioning
Goto Forum:
  


Current Time: Mon Dec 23 06:00:19 CST 2024