Re: Ansi SQL and stored procedures

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 25 Feb 2005 06:22:45 -0800
Message-ID: <1109341365.190843.236150_at_f14g2000cwb.googlegroups.com>


tiz wrote:
> Hi, i'm trying to exec a simple stored proc with In and Out params:
>
> PROCEDURE GETNOMEFROMCOGNOME1
> Argument Name Type In/Out
Default?
> ------------------------------ ----------------------- ------



> COGNOME VARCHAR2 IN
> NOME VARCHAR2 OUT
>
> that's my code (basically):
>
> EXEC SQL ALLOCATE DESCRIPTOR 'input_descriptor';
> EXEC SQL ALLOCATE DESCRIPTOR 'output_descriptor';
>
> EXEC SQL PREPARE prep_statement FROM : dyn_statement;
>
> EXEC SQL SET DESCRIPTOR 'input_descriptor' VALUE 1 TYPE =
> :ANSI_varchar_type, LENGTH = :input_len, DATA = :cognome_data;
> EXEC SQL SET DESCRIPTOR 'input_descriptor' VALUE 2 TYPE =
> :ANSI_varchar_type, LENGTH = :input_len, DATA = :cognome_data;
>
> EXEC SQL SET DESCRIPTOR 'output_descriptor' VALUE 1 DATA=:a, TYPE =
> :ANSI_varchar_type;
> EXEC SQL SET DESCRIPTOR 'output_descriptor' VALUE 2 DATA=:b, TYPE =
> :ANSI_varchar_type;
>
> EXEC SQL EXECUTE prep_statement USING DESCRIPTOR 'input_descriptor' ;
>
> The error I get is:
> ORA-01422: exact fetch returns more than requested number of rows
>
>
> That's wrong with this code?
> Could so help me, please???
>
> thx
> tiz

Please post the code of your procedure instead of just a description. Most likely you have a "select into..." clause in there which returns more then one row. If that is the case then rewrite your query to return only one row or open it in a cursor loop.

Regards
/Rauf Received on Fri Feb 25 2005 - 15:22:45 CET

Original text of this message