|
|
|
|
|
|
|
|
|
|
Re: IBM DB2 to Oracle PLSQL Current Day and day code conversion [message #638546 is a reply to message #638545] |
Sun, 14 June 2015 23:51 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
Sorry I didn't have access to DB earlier, you could do it like this:
SQL> SELECT SYSDATE, TRUNC(SYSDATE, 'MM') -1 LAST_DAY_PREV_MNTH FROM dual;
SYSDATE LAST_DAY_
--------- ---------
15-JUN-15 31-MAY-15
SQL> SELECT SYSDATE, LAST_DAY(ADD_MONTHS(SYSDATE,-1)) LAST_DAY_PREV_MNTH FROM dual;
SYSDATE LAST_DAY_
--------- ---------
15-JUN-15 31-MAY-15
SQL>
To display it in your desired format, use TO_CHAR along with your desired format model. You could see Blackswan's example how TO_CHAR is used.
[Updated on: Sun, 14 June 2015 23:53] Report message to a moderator
|
|
|
|