views:

50

answers:

4

Does anyone know if it is possible to take the date from a random date in pl sql.

example.

SELECT SYSDATE FROM DUAL

and here the output would be say : 26-10-2010 13:30:34

Now I want to have just the date as a number. In this case that would be 26.

Or is there some sort of function like IsNum that can recognize it for me. So I can just take 26 and leave the rest out.

+3  A: 
select to_char(sysdate,'DD') as day from dual
Tony Andrews
Thank you , I 've used yours since this one fits my needs perfectly.
jovany
+5  A: 

You can also use EXTRACT(), like so:

SELECT EXTRACT(DAY FROM SYSDATE) AS DAY FROM DUAL;
BoltClock
excellent thanks.
jovany
+3  A: 

You can use

to_char(SYSDATE, 'DD')

More you can read here: LINK

infinity
Thanks for the link.
jovany
+2  A: 

All format models are described in the official SQL Reference, take a look in case you need something else

andr