Home » SQL & PL/SQL » SQL & PL/SQL » ORA-01722: invalid number (Oracle 11g )
ORA-01722: invalid number [message #630339] Wed, 24 December 2014 18:20 Go to next message
Oracle_Walker
Messages: 71
Registered: January 2012
Location: United States
Member

Hi,

When executing the below code in stored procedure, I am getting 'ORA-01722 : invalid number'. The variable 'V_LIST' holds the value of 10,20,40. Please help.
PROCEDURE INTIALIZE_SECOND(DUMMY NUMBER)
AS
-- Variable declaration
V_LIST VARCHAR2(100);


BEGIN

SELECT VALUE INTO V_LIST FROM CONFIG_PARAMS
WHERE NAME = 'notf';

MERGE INTO TEMP ST USING
(SELECT EXT.KEY
FROM EXTN EXT, DETAILS D
WHERE EXT.KEY            = D.KEY
AND EXT.STATUS         IN V_LIST
) INNER_QUERY ON (ST.KEY = INNER_QUERY.KEY)
WHEN NOT MATCHED THEN
  INSERT
    (
      SEQ_NO,
      KEY,
      FLAG
    )
    VALUES
    (
      SEQ.nextval,
      INNER_QUERY.KEY,
      'Y'
    );
END INTIALIZE_SECOND;
Re: ORA-01722: invalid number [message #630340 is a reply to message #630339] Wed, 24 December 2014 18:27 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
How can we reproduce what you report?

>I am getting 'ORA-01722 : invalid number'.
which line throws error?

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/

Re: ORA-01722: invalid number [message #630356 is a reply to message #630339] Thu, 25 December 2014 04:36 Go to previous messageGo to next message
Michel Cadot
Messages: 68776
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

I have not the same error than you:
SQL> PROCEDURE INTIALIZE_SECOND(DUMMY NUMBER)
  2  AS
  3  -- Variable declaration
  4  V_LIST VARCHAR2(100);
  5  
  6  
  7  BEGIN
  8  
  9  SELECT VALUE INTO V_LIST FROM CONFIG_PARAMS
 10  WHERE NAME = 'notf';
 11  
 12  MERGE INTO TEMP ST USING
 13  (SELECT EXT.KEY
 14  FROM EXTN EXT, DETAILS D
 15  WHERE EXT.KEY            = D.KEY
 16  AND EXT.STATUS         IN V_LIST
 17  ) INNER_QUERY ON (ST.KEY = INNER_QUERY.KEY)
 18  WHEN NOT MATCHED THEN
 19    INSERT
 20      (
 21        SEQ_NO,
 22        KEY,
 23        FLAG
 24      )
 25      VALUES
 26      (
 27        SEQ.nextval,
 28        INNER_QUERY.KEY,
 29        'Y'
 30      );
 31  END INTIALIZE_SECOND;
 32  /
PROCEDURE INTIALIZE_SECOND(DUMMY NUMBER)
*
ERROR at line 1:
ORA-00900: invalid SQL statement

Re: ORA-01722: invalid number [message #630410 is a reply to message #630356] Fri, 26 December 2014 10:34 Go to previous messageGo to next message
Oracle_Walker
Messages: 71
Registered: January 2012
Location: United States
Member

The issue is when I am trying to use the variable 'v_list' in a WHERE CLAUSE within the merge query, I am getting this error. This variable holds a list of comma separated numbers(12,23,234).

Sorry team for not posting the tested code. As I cannot be able to post the original code.
Re: ORA-01722: invalid number [message #630411 is a reply to message #630410] Fri, 26 December 2014 11:11 Go to previous messageGo to next message
Michel Cadot
Messages: 68776
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Search for "varying in list".

Re: ORA-01722: invalid number [message #630416 is a reply to message #630411] Fri, 26 December 2014 13:37 Go to previous message
Oracle_Walker
Messages: 71
Registered: January 2012
Location: United States
Member

Thanks Michel. I have got the solution from Ask Tom forum.
Previous Topic: Error in pl/sql Bubble sort code
Next Topic: When NOLOGGING will not be in effect
Goto Forum:
  


Current Time: Mon Aug 24 10:01:29 CDT 2026