How can i get set identity for last coloumn of the table.

Showing Answers 1 - 19 of 19 Answers

rkowdeed

  • Sep 19th, 2006
 

Query the table USER_TAB_COLUMNS as

SELECT * FROM USER_TAB_COLUMNS WHERE TABLE_NAME=V_TABLE_NAME AND ROWNUM=1 ORDER BY COLUMN_ID DESC

Here  V_TABLE_NAME is the table name.

Anil

  • Apr 17th, 2007
 

Dear,
    No need 2 go for that.
 just describe the table name.
  Desc table_name;
just scroll the mouse and u can see the last column

  Was this answer useful?  Yes

SIVARAMAN

  • Jul 12th, 2007
 


using user_tab_columns data dictionary

SELECT * FROM(SELECT * FROM USER_TAB_COLUMNS WHERE TABLE_NAME='OUTLET_ITEM_MASTER' ORDER BY COLUMN_ID DESC)
WHERE ROWNUM=1

  Was this answer useful?  Yes

osden

  • Oct 6th, 2007
 

select column_name from (select * from user_tab_columns where table-name ='EMP' order by column_id) where rownum=1;

  Was this answer useful?  Yes

select * from (select rownum r, a.* from user_tab_columns a where table_name ='EMPLOYEE') where r=(select count(column_id) from user_tab_columns where table_name ='EMPLOYEE')

  Was this answer useful?  Yes

Nitesh Srivastava TechM

  • Nov 10th, 2011
 

See the code below

Code
  1. SELECT * FROM USER_TAB_COLUMNS WHERE TABLE_NAME='EMP'

  2. AND column_id = (SELECT MAX(column_id) FROM USER_TAB_COLUMNS WHERE TABLE_NAME='EMP')

  3. ORDER BY COLUMN_ID

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions