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

Answers were Sorted based on User's Feedback



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

Answer / welcomeashwin

ORA-00909 invalid number of arguments

Cause: An Oracle function was referenced with an incorrect
number of arguments. All Oracle functions, except for
SYSDATE, require at least one argument.

Action: Correct the syntax of the function by entering the
required number of arguments.

Is This Answer Correct ?    33 Yes 3 No

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

Answer / nitin

Let SYSDATE = '20-Sep-2012'

Use below query,

select to_char(trunc(add_months(sysdate,-
3),'mm'),'mm/dd/yyyy') from dual;

It will give you ...
o/p :

'06/01/2012'

Is This Answer Correct ?    15 Yes 9 No

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

Answer / praveen

Let sysdate=30/07/2012;

let see dis query
select add_months(sysdate,-3) from dual;
//ans=07/30/2012-mm/dd/yyyy
select trunc(add_months(sysdate,-3),'mm') from dual;
//ans=07/01/2012-mm/dd/yyyy
select to_char(trunc(add_months(sysdate,-3),'mm'),'mm/dd/yyyy from dual;
//ans=07/01/2012-mm/dd/yyyy

Is This Answer Correct ?    4 Yes 0 No

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

Answer / dinesh kumar

Invalid Character Error

Is This Answer Correct ?    0 Yes 0 No

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

Answer / 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

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

Answer / rajeev

select to_char(trunc(add_months(sysdate-3),mm),mm/dd/yyyy) from dual--This query will return error...
we can use below query..
select to_char(trunc(add_months(sysdate-1,3),'mm'),'mm/dd/yyyy') from dual;
output:05/01/2018

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

ERROR:Insert or update on table"accnt" violates foreign key constraints "acct_to_curr_symbol" DETAILS:KEY(accnt_curr_id)(-2)is not present in the table "curr_symbol" ......solve The Problem..

0 Answers   Wipro,


How to remove duplicate rows from a table?.

3 Answers  


Do triggers have restrictions on the usage of large datatypes, such as long and long raw?

0 Answers  


What is data profiling in sql?

0 Answers  


what are the difference between clustered and a non-clustered index? : Sql dba

0 Answers  






Main diff between varray and nested tablea

3 Answers   Polaris, TCS,


What is anonymous block in sql?

0 Answers  


What are all the different types of indexes?

0 Answers  


How would you reference column values before and after you have inserted and deleted triggers?

0 Answers  


What are the advantages of pl sql?

0 Answers  


Which normal form is best?

0 Answers  


What are the difference between Functions/Stored Procs and Triggers and where are they used.

1 Answers   CGI, TCS,


Categories