Re: Variables in EXECUTE PROCEDURE statement
Posted in 1997
>From: Neil Truby <ntruby@netcomuk.co.uk>
>Date: Wed, 22 Jan 1997 08:39:23 +0000
>X-Informix-List-Id: <news.32854>
>
>Our third-party vendor has supplied a procedure to delete rows in a
>table older than a specified DATETIME, e.g.:
>
>execute procedure delete_logs('1997-01-15 00:00:00')>
>But how can I put a variable in the above SQL?:
>
>execute procedure delete_logs(TODAY - 7)>
>fails with a "non-numeric character" message.
You should probably attempt to provide a DATETIME variable rather than
a DATE variable...
EXECUTE PROCEDURE Delete_Logs(CURRENT YEAR TO DAY - 7 UNITS DAY);
Using the following test version of the procedure, I get the result
1997-01-15 00:00:00 exactly as required.
CREATE PROCEDURE delete_logs(d DATETIME YEAR TO SECOND)
RETURNING DATETIME YEAR TO SECOND; RETURN d;
END PROCEDURE;
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>