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 the sql query to display the current date?

549


Show the cursor attributes of pl/sql.

609


Can we rename a column in the output of sql query?

542


What do you understand by exception handling in pl/sql?

577


How do you write a subquery?

521






how to increment dates by 1 in mysql? : Sql dba

540


how to concatenate two character strings? : Sql dba

551


Can we rollback delete command?

513


What are sql objects?

539


Give the order of sql select?

613


What is the usage of when clause in trigger?

566


what are the advantages and disadvantages of cascading style sheets? : Sql dba

548


Enlist the data types that can be used in pl/sql?

573


What is db journal file?

519


Are subqueries better than joins?

533