0

I have a create table tab1

CREATE TABLE tab1(
 tabid number(10),
 tabname  varchar2(10),
 tabtype  varchar2(10),
 tabstatus varchar2(10),
 tabaddress varchar2(10)
);

I have tired to select column header using the following code:

SELECT *
FROM myschema.COLUMNS
WHERE TABLE_NAME = 'tab1';

I want to create a view using columns headers.

jarlh
  • 42,561
  • 8
  • 45
  • 63
brids
  • 25
  • 2
  • 11

1 Answers1

0

you can find information about column in the user_tab_cols view. You can retrieve the column headers with a query like:

SELECT COLUMN_NAME FROM USER_TAB_COLS WHERE TABLE_NAME = 'TAB1'

If you are not connected as the table owner you can use this (make sure schema and table name are in capital letters):

SELECT COLUMN_NAME FROM ALL_TAB_COLS WHERE TABLE_NAME = 'TAB1' 
                                           AND OWNER = 'MYSCHEMA'
simhumileco
  • 31,877
  • 16
  • 137
  • 115
MDP89
  • 306
  • 1
  • 9