Solved

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

Posted on 2008-10-22
3
5,516 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 125 total points
ID: 22780539
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 74

Expert Comment

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

Expert Comment

by:sdstuber
ID: 22780584
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example, show how to take different types of Oracle backups using RMAN.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

763 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