If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > error calling Stored procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-26-09, 16:16
Microchip Microchip is offline
Registered User
 
Join Date: Oct 2009
Posts: 3
error calling Stored procedure

Hello!
Excuse me for my English!

I create a stored procedure on a DB2 database.

Code:
CREATE PROCEDURE SCHEMAPROVA."prova"
  (OUT SQLCODE_OUT INTEGER,
    OUT SQLSTATE_OUT CHARACTER(5))
  SPECIFIC SCHEMAPROVA."prova"
  READS SQL DATA
  NOT DETERMINISTIC
  CALLED ON NULL INPUT
  LANGUAGE SQL

  P1: BEGIN
        DECLARE SQLSTATE CHAR(5) DEFAULT '00000';
        DECLARE SQLCODE INT DEFAULT 0;

        DECLARE CAMPO1(16);
        DECLARE CAMPO2(40);

        DECLARE cursor1 CURSOR WITH RETURN FOR
            SELECT 
            SCHEMAPROVA.TABELLACAMPO2,
            SCHEMAPROVA. TABELLA.CAMPO2, 
            FROM SCHEMAPROVA.TABELLA

          DECLARE EXIT HANDLER FOR SQLEXCEPTION

          SELECT SQLSTATE, SQLCODE INTO SQLSTATE_OUT, SQLCODE_OUT
          FROM SYSIBM.SYSDUMMY1;

          OPEN cursor1;
          FETCH cursor1 INTO CAMPO1, CAMPO2;
          CLOSE cursor1;

          SET SQLCODE_OUT = SQLCODE;
          SET SQLSTATE_OUT = SQLSTATE;

END P1;

but if I execute CALL SCHEMAPROVA."prova" ()
I get
Code:
An exception occurred
Message: [IBM][CLI Driver][DB2/NT] SQL0444N  La routine "EQNRS.prova" (nome specifico "SQL091022182100200") è stata implementata con codice nella libreria o percorso "\EQNRS.prova", funzione "EQNRS.prova" ai quali non è possibile accedere.  Codice di errore: "4".  SQLSTATE=42724
SQL: CALL EQNRS."prova"()
Method: TDB2DirQuery.Execute
If I wrote a procedure with IN parameters or without parameters, it's works.
With OUT parameters doesn't work!!!

Please, can you help me?

Thanks
Reply With Quote
  #2 (permalink)  
Old 10-26-09, 16:41
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Try: CALL SCHEMAPROVA."prova" (?,?)

Andy
Reply With Quote
  #3 (permalink)  
Old 10-26-09, 19:30
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Also, I don't think it is a good idea to make the procedure name case sensitive.
Reply With Quote
  #4 (permalink)  
Old 10-26-09, 20:02
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by n_i
Also, I don't think it is a good idea to make the procedure name case sensitive.
How many lashes do you get for doing that?
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 10-27-09, 03:27
Microchip Microchip is offline
Registered User
 
Join Date: Oct 2009
Posts: 3
case sensitive is not a problem: the same procedure works without parameters or with only IN parameters.

with CALL SCHEMAPROVA."prova" (?,?) I get an other error of IN, OUT, INOUT parameters...

Code:
An exception occurred
Message: [IBM][CLI Driver] CLI0100E  Numero errato di parametri. SQLSTATE=07001
SQL: CALL "SCHEMAPROVA"."prova"( ?,?)
Method: TDB2DirQuery.Execute

Last edited by Microchip; 10-27-09 at 05:21.
Reply With Quote
  #6 (permalink)  
Old 10-27-09, 08:39
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
How are you trying to call the Stored Procedure? If you are using the CLP then the method I gave you should work. If you are doing it from an application, then you need to see how to implement OUT parameters in whatever you are using.

Andy
Reply With Quote
  #7 (permalink)  
Old 10-27-09, 16:10
Microchip Microchip is offline
Registered User
 
Join Date: Oct 2009
Posts: 3
I tried using DB2 Maestro.

I tried to test stored procedure using IBM RSA and... it works!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On