Home » SQL & PL/SQL » SQL & PL/SQL » Column in Table
Column in Table [message #8605] Wed, 03 September 2003 08:37 Go to next message
saravanan
Messages: 70
Registered: October 2000
Member
How many columns be in a table
Re: Column in Table [message #8606 is a reply to message #8605] Wed, 03 September 2003 08:56 Go to previous message
Art Metzer
Messages: 2480
Registered: December 2002
Senior Member
quote from Saravanan:
----------------------------------------------------------------------
How many columns be in a table

----------------------------------------------------------------------
Well, to find out how many columns are in a given table, issue:
SQL> SET VERIFY OFF
SQL> <font color=blue>SELECT COUNT(*)</font>
  2  <font color=blue>FROM   sys.user_tab_columns   utc</font>
  3  <font color=blue>WHERE  UPPER(utc.table_name) = '&1'</font>
  4  /
Enter value for 1: EMP
  
  COUNT(*)
----------
         8
  
SQL> /
Enter value for 1: DEPT
  
  COUNT(*)
----------
         3
  
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)
  
SQL> DESC dept
 Name                            Null?    Type
 ------------------------------- -------- ----
 DEPTNO                          NOT NULL NUMBER(2)
 DNAME                                    VARCHAR2(14)
 LOC                                      VARCHAR2(13)
  
SQL> 
But if you're asking about the maximum number of columns an Oracle database table may hold, this quote from the documentation states:
----------------------------------------------------------------------
The absolute maximum number of columns in a table is 1000. However, when you create an object table (or a relational table with columns of object, nested table, varray, or [i]REF[/i] type), Oracle maps the columns of the user-defined types to relational columns, creating in effect "hidden columns" that count toward the 1000-column limit.

----------------------------------------------------------------------
A.
Previous Topic: Select Query
Next Topic: Index
Goto Forum:
  


Current Time: Fri Apr 26 01:45:27 CDT 2024