Sunday, 15 September 2013

Update sql in perl script - execute statement stuck -


Something is going wrong in the execute statement. It always seems to hang for when I run it in the command prompt. It does not die either, what parameter might be required?

  #! Use / usr / bin / perl DBI; Use data: Dumper; $ Dbh = dbi- & gt; Connect ('db', 'NAME', 'PASS', {LongReadLen => 1000000}) or 'Error: Can not connect to DB'; $ St = "Update table set the_id = 7 where middle = 23 and tid = 22"; My $ UpdateRecord = $ dbh- & gt; Ready ($ st) or die "The statement could not be prepared: $ st". $ Dbh- & gt; Errstr; $ UpdateRecord- & gt; Execute () or die "$ UpdateRecord can not execute". $ Dbh- & gt; Errstr; $ UpdateRecord- & gt; Finish; $ Dbh- & gt; Disconnect (); Edit: 
I tried to use bind_param () with a compulsive effort, and it is still hanging.

You need ready instead of My $ updated record = $ dbh- & gt; ($ St) or die "Details failed: $ st". $ Dbh- & gt; Errstr;

:

This method is generally useful for non-selection statements that can not be prepared in advance (driver's limit) Reason) or need not be executed repeatedly should not be selected for SELECT statement because it does not return a statement (so you can not bring any data).

In addition to this, always add the DB driver module / you are using, Use DBI at the top after the statement.

Use DBD :: Oracle ;

Apart from this

Strict use; Use of warning;

No comments:

Post a Comment