Subject | How do I return value from a SP without SUSPEND? (Delphi specific) |
---|---|
Author | Louis van Alphen |
Post date | 2001-07-31T08:34:01Z |
I hope someone can shed some light on this. I am sure I am missing
something small....
I have a SP like the following
CREATE PROCEDURE PROC(IN_VALUE INTEGER)
RETURNS(OUT_VALUE INTEGER)
AS
BEGIN
OUT_VALUE = IN_VALUE;
END
Not a very fancy SP you might say, but it's just for the sake of the
example. 8-)
I want to EXECUTE the SP from Delphi with a TQuery to ge the return value.
I realise that you can add a SUSPEND into the SP and do a SELECT in DELPHI,
but I specifically do not want to do this for particular reaons (I am using
a generic function to get the output values).
I want to execute the following query in Delphi: EXECUTE PROCEDURE
PROC(2) and somehow get the return value. I get a 'Parameter not set'
error in Delphi when I execute the SQL.
Here is the code:
qrySQL.SQL.Clear;
qrySQL.SQL.Add('EXECUTE PROCEDURE PROC(2)');
qrySQL.ExecSQL;
I can understand the error, because Delphi expects an output parameter to
be set up.
I tried (in delphi)
EXECUTE PROCEDURE PROC(2) INTO :P
and
EXECUTE PROCEDURE PROC(2) RETURNING_VALUES :P
None of these work.
Any suggestions of how this can be done?
Thanks in advance for any suggestions.
L.J. van Alphen
lja@...
something small....
I have a SP like the following
CREATE PROCEDURE PROC(IN_VALUE INTEGER)
RETURNS(OUT_VALUE INTEGER)
AS
BEGIN
OUT_VALUE = IN_VALUE;
END
Not a very fancy SP you might say, but it's just for the sake of the
example. 8-)
I want to EXECUTE the SP from Delphi with a TQuery to ge the return value.
I realise that you can add a SUSPEND into the SP and do a SELECT in DELPHI,
but I specifically do not want to do this for particular reaons (I am using
a generic function to get the output values).
I want to execute the following query in Delphi: EXECUTE PROCEDURE
PROC(2) and somehow get the return value. I get a 'Parameter not set'
error in Delphi when I execute the SQL.
Here is the code:
qrySQL.SQL.Clear;
qrySQL.SQL.Add('EXECUTE PROCEDURE PROC(2)');
qrySQL.ExecSQL;
I can understand the error, because Delphi expects an output parameter to
be set up.
I tried (in delphi)
EXECUTE PROCEDURE PROC(2) INTO :P
and
EXECUTE PROCEDURE PROC(2) RETURNING_VALUES :P
None of these work.
Any suggestions of how this can be done?
Thanks in advance for any suggestions.
L.J. van Alphen
lja@...