What will be the output of this Query?
select to_char(trunc(add_months(sysdate-3),mm),mm/dd/yyyy) from dual

Answer Posted / sreeharibabu

select to_char(trunc(add_months(sysdate,-3),'mm'),'mm/dd/yyyy') from dual;--sysdate:22-APR-2016 output :01/01/2016
-- corrections in add_months , mm ,mm/dd/yyyy
--- flow--
select add_months(sysdate,-3) from dual;--sysdate:22-APR-2016 -- output : 1/22/2016 8:15:24 AM

select trunc(add_months(sysdate,-3),'mm') from dual;--sysdate:22-APR-2016 output : 01/01/2016

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is insert command in sql?

526


How do I run sql?

612


What is nvarchar in sql?

520


What are hotfixes and patches?

527


What is pl sql record in oracle?

563






What is posting?

603


How do I copy a table in sql?

515


How to sort the rows in sql.

600


What is the difference between inner join and left join?

541


What is secondary key?

508


What is full form of rtm?

530


How does sql*loader handles newline characters in a record? : aql loader

586


Is sql free?

499


what is user defined functions? : Sql dba

545


What is a pdo connection?

512