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
)?
Asked
Active
Viewed 27 times
0
-
What database engine is that? Oracle? – Luaan Mar 18 '15 at 17:01
2 Answers
0
The following can be the solution :
select Column_Name from INFORMATION_SCHEMA.COLUMNS where Table_Name = 'Tablename' and DATA_TYPE='Varchar'

Ram Vanamali
- 26
- 2
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