-
Stored Procedure Output parameter issue using esql/c
Hi,
I am trying to use some esql/c to run a stored procedure which should return 2 output parameters. I have tested the stored proc in Query analyser and it works fine however when I run the esql/c code I get a -179 error which apparantly indicates that I am trying to send constants to the stored proc when using the Output param which is illegal! As I have not declared any of the varaibles as constants I have no idea why I am getting this error, can anyone help?
The stored proc is defined as:
CREATE PROCEDURE p_stl_esqltest
@input_int INT ,
@input_char VARCHAR(255) OUTPUT ,
@rc INT OUTPUT,
@error_desc VARCHAR(255) OUTPUT
AS
BEGIN
set @rc = @input_int * 10
set @error_desc = 'Heres your input char:' + @input_char
insert into temp (dd,inint,outint,instr,outstr) values (getdate(),@input_int,@rc,@input_char,@error_desc)
END
GO
If I run it through query analyser it works fine:
/* sql run thro query analyser - and works
declare @input_int INT
declare @input_char VARCHAR(255)
declare @rc INT
declare @error_desc VARCHAR(255)
select @input_int=10
select @input_char='MyInput'
exec p_stl_esqltest @input_int, @input_char, @rc output, @error_desc output
print @input_int
print @input_char
print @rc
print @error_desc
However as soon as I uses embedded sql to run the stored procedure it doesn't run:
int dotemp()
{
exec sql begin declare section;
int iin=10;
int iout=0;
int iout2=0;
char szIn[256]="MyInString:";
char szOut[256];
int iret = 0;
exec sql end declare section;
EXEC SQL exec p_stl_esqltest :iin, :szIn, :iout output, :szOut output;
iret = sqlca.sqlcode;
DBSWITCH_COMMIT
return iret;
}
Have tried all these in the place of the EXEC SQL in the esql/c but to no avail:
/* do not work */
EXEC SQL EXEC p_stl_esqltest :iin, :szIn, :iout, :szOut into iout2;
EXEC SQL select exec p_stl_esqltest :iin, :szIn, :iout, :szOut into iout2;
EXEC SQL exec p_stl_esqltest :iin, :szIn, output :iout,output :szOut;
EXEC SQL EXEC p_stl_esqltest :iin, :szIn, :iout output, :szOut output;
/* works but out values not returned */
EXEC SQL exec p_stl_esqltest :iin, :szIn, :iout, :szOut;
Similar Threads
-
By Yazilim in forum Database
Replies: 2
Last Post: 11-22-2006, 06:18 PM
-
By susan in forum VB Classic
Replies: 4
Last Post: 12-21-2002, 01:32 AM
-
By Xin Li in forum Database
Replies: 0
Last Post: 01-04-2001, 04:49 PM
-
By John Hadzima in forum Database
Replies: 2
Last Post: 06-29-2000, 10:42 AM
-
By Naveen in forum VB Classic
Replies: 1
Last Post: 06-13-2000, 06:05 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|