How do I call Informix stored procedures from Perl? -
How do I call informix stored processes from Perl? I use DBD :: ODBC to access the database, but I do not know how to call processes, my code is like this:
my $ dbh = dbi-> gt; ; Connect ("DBI:". DBDREVEVE. ":". DBNA, DBUSER, DBPASS, {RICE ERROR =>, PrintArror = & gt; 0, AutoConnect => 1}) || Die $ dbi :: errstr; $ Dbh- & gt; Do ("executed process sp_test ('2010-05-01 00:00:00')") || Warning "failed \ n"; $ Dbh- & gt; Disconnect ();
When I run it, it did not get an error, but when I check the database, I can not find anything if I run it directly in the database, then the shop process works fine. Anyone can help me?
It looks weird, you need fetch ()
To handle your stored procedure in your statement, try changing your do ()
call instead:
My $ sth = $ dbh - & gt; Ready ("executed process sp_test ('2010-05-01 00:00:00')") or die $ dbh-> gtstr; $ Sth- & gt; Execute () or $ dbh-> $ errr $ sth- & gt; Fetch (); #Spl has actually been executed here
(You can add RaiseError => 1
to your options on
Think ... or die ...
Avoid stuff after each call.)
Comments
Post a Comment