Solved

PL/SQL: ORA-00909: invalid number of arguments

Posted on 2008-10-22
3
5,215 Views
Last Modified: 2013-12-07
I have a query that I get this error: PL/SQL: ORA-00909: invalid number of arguments
The purpose of this query is:
-- If execution (current) date is MON then get previous THU into v_begin_date.
-- If execution (current) date is THU then get previous MON into v_begin_date.
-- v_end_date is set to previous day.
-- date range will be THU through SUN for a MON execution.
-- date range will be MON through WED for a THU execution.

SELECT NEXT_DAY(TRUNC(SYSDATE,
  CASE TO_CHAR(SYSDATE, 'DY') WHEN 'MON' THEN 'THU' ELSE 'MON' END)) -7,
  TRUNC(SYSDATE-1) INTO v_begin_date, v_end_date FROM dual;

What do I do wrong for this query (PL/SQL: ORA-00909: invalid number of arguments)?
0
Comment
Question by:scpig
  • 3
3 Comments
 
LVL 73

Accepted Solution

by:
sdstuber earned 125 total points
Comment Utility
SELECT   NEXT_DAY(TRUNC(SYSDATE), CASE TO_CHAR(SYSDATE, 'DY') WHEN 'MON' THEN 'THU' ELSE 'MON' END)
         - 7,
         TRUNC(SYSDATE - 1)
INTO     v_begin_date, v_end_date
FROM     DUAL;
0
 
LVL 73

Expert Comment

by:sdstuber
Comment Utility
you were missing the parentheses after TRUNC(SYSDATE)  and instead had an extra paretheses at the end of the case
0
 
LVL 73

Expert Comment

by:sdstuber
Comment Utility
also note your "if" conditions and your case don't quite match.

the case as written does
if today is Monday then return previous Thursday
otherwise return previous Monday  (no special check for Thursday)

your if's didn't have a condition described for days other than Monday or Thursday.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now