DATE argument passed from ESQLC to SPL
Posted in 1999
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration
I have an esqlc program that gets a date from the user, converts it
(successfully!) into a valid long value, and then uses the date when
updating some tables in the database. When I re-wrote the processing
from an ESQLC cursor to a stored procedure, I needed to pass the date
from my program to the procedure:
EXEC SQL EXECUTE PROCEDURE xyz_cursor_calc ( datevalue );
the SPL code says:
CREATE PROCEDURE xyz_cursor_calc ( mydate DATE ) returning INT; ....
When I call the SP from dbaccess, it works fine:
EXECUTE PROCEDURE xyz_cursor_calc ( "11/26/1999");
but when I do it from inside my eslqc program I get the
less-than-illuminating -201 error.
Should I send a text string instead of a long value? If so, why?
Parenthetically, any good books on Informix SPL, as the manuals are not
so good on that subject?
Bradford Young wrote:
> I have an esqlc program that gets a date from the user, converts it
> (successfully!) into a valid long value, and then uses the date when
> updating some tables in the database. When I re-wrote the processing
> from an ESQLC cursor to a stored procedure, I needed to pass the date
> from my program to the procedure:
> EXEC SQL EXECUTE PROCEDURE xyz_cursor_calc ( datevalue );
>
> the SPL code says:
> CREATE PROCEDURE xyz_cursor_calc ( mydate DATE ) returning INT;> ....
>
> When I call the SP from dbaccess, it works fine:
> EXECUTE PROCEDURE xyz_cursor_calc ( "11/26/1999");>
> but when I do it from inside my eslqc program I get the
> less-than-illuminating -201 error.
And if you're seeking illumination from us, maybe you'd be so good as to
show us the ESQL/C code which is failing? Are you trying to PREPARE the
statement or are you simply executing it?
Are you using a variable and therefore you need a question mark place
holder in the statement and a USING clause when you EXECUTE? Are you
trying to give the name of the variable in the
prepared string? Who can tell...
> Should I send a text string instead of a long value? If so, why?
>
> Parenthetically, any good books on Informix SPL, as the manuals are not
> so good on that subject?
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN
#include <disclaimer.h>
It appears as if your problem is in the ESQL part, not the SP.
All the same, if your SP is expecting a DATE variable, send it a date
variable or something that can be converted to a valid date. We have ESQL
programs interacting with SPs receiving and sending all possible data
types successfully.
Whenever I have received the 201 error (v7.3, HP10.20), its always been
because there was a goof-up in the creation of the string to be EXEC
SQLed, PREPAREd or EXECUTEd.
HTH
Rudy
Bradford Young wrote:
> I have an esqlc program that gets a date from the user, converts it
> (successfully!) into a valid long value, and then uses the date when
> updating some tables in the database. When I re-wrote the processing
> from an ESQLC cursor to a stored procedure, I needed to pass the date
> from my program to the procedure:
> EXEC SQL EXECUTE PROCEDURE xyz_cursor_calc ( datevalue );
>
> the SPL code says:
> CREATE PROCEDURE xyz_cursor_calc ( mydate DATE ) returning INT;> ....
>
> When I call the SP from dbaccess, it works fine:
> EXECUTE PROCEDURE xyz_cursor_calc ( "11/26/1999");>
> but when I do it from inside my eslqc program I get the
> less-than-illuminating -201 error.
>
> Should I send a text string instead of a long value? If so, why?
>
> Parenthetically, any good books on Informix SPL, as the manuals are not
> so good on that subject?