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
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 |
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 |
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 |
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 |
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 |
List out the acid properties and explain?
how many tables will create when we create table, what are they? : Sql dba
Is pl sql a programming language?
What are sql commands?
How are multiple column = value pairs delimited in the SET clause of an UPDATE statement? 1. With commas (SET price = 0, status = 'I') 2. With parentheses (SET (price = 0) (status = 'I')) 3. With double-pipes (SET price = 0 || status = 'I') 4. With square-brackets (SET [price = 0] [status = 'I'] 5. With single or multiple spaces (SET price = 0 status = 'I')
Does a join table need a primary key?
How to select random rows from a table?
What is the best partition size for windows 10?
oracle is compiler or interpretter,can any one tell me the answer?
What is mutating error in pl sql?
Mention what are different methods to trace the pl/sql code?
What is serial sql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)