0

I want to know if there is a method in which we can select the columns of a table of a specific datatype in a table that has columns of various datatypes. Say a table has three columns - SSN, Name and phone number where SSN and Name are of Varchar2 and phone number is of number datatype, can I extract only the columns that has its datatype as varchar2(SSN and Name)?

Azat
  • 6,745
  • 5
  • 31
  • 48
Vishnu
  • 3
  • 1

2 Answers2

0

The following can be the solution :

select Column_Name from INFORMATION_SCHEMA.COLUMNS where Table_Name = 'Tablename' and DATA_TYPE='Varchar'

0

If I have understood your question correctly then this should work.

select * from TABLE_NAME
where DATA_TYPE = 'Varchar2';
Eoin2211
  • 911
  • 2
  • 19
  • 39
  • Im sorry E_McAndrew but the query did not worked. I have got the answer for it. And thank you so much for your help. Appreciate it :) – Vishnu Apr 05 '15 at 15:24