Q: ISDATE Function in Oracle I am developing a web application which is getting data from an Oracle DB. The select statements are created dynamically. What I want to do is, whenever I select a date field in a table, it should return it to a string with the format of dd.mm.yyyy
what I need is basically a way to have a function like isdate(COLUMN_NAME, true stmt, false stmt)
SELECT ISDATE(First Column, to_char(FirstColumn,'dd.mm.yyyy'), FistColumn)
  FROM ANYTABLE

is there a way for this?

A: You can check to see what the data type is for that table using the data dictionary, and connect multiple versions of the same query to handle whatever data type it might be.
For example let's say you had this table:
create table tbl_char (dt varchar2(10));
insert into tbl_char values ('01.03.2013');

And then ran:
select to_char(dt, 'dd.mm.yyyy')
  from tbl_char
 where exists (select 'x'
          from all_tab_cols
         where table_name = 'TBL_CHAR'
           and column_name = 'DT'
           and data_type = 'DATE')
union all
select dt
  from tbl_char
 where exists (select 'x'
          from all_tab_cols
         where table_name = 'TBL_CHAR'
           and column_name = 'DT'
           and data_type = 'VARCHAR2')

You would get one row, "01.03.2013", as output, because only the 2nd query actually ran. The first would have returned an error if not for the filter resulting from the EXISTS subquery. Now, if we were to change that varchar field over to a date, we would get exactly the same output, only the result would technically be from the first query. The second would run and return no rows.
sql fiddle: http://sqlfiddle.com/#!4/0001d/1/0
