You are disconnecting from the database handle at the bottom of execsql(). -- Mac :}) ** I normally forward private questions to the appropriate mail list. ** Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.htm Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, February 03, 2002 10:13 Subject: RE: DBI Oracle Database Handle trouble
> First of all, the versions of software I'm running are: > Oracle8i Enterprise Edition Release 8.1.7.2.0 > perl5 (5.0 patchlevel 4 subversion 4) > Solaris 2.6 > > The sample of code which I'm using to test is attached (test.pl), and > the output > I get (including an echo of the first SQL, a result status, an echo of > the > 2nd SQL, and then the error) is as follows: > > BEGIN sp_exec_imm('drop index CMBUS1'); END; > Return Status: 1 > select trade_date, host_cust_id from cm_trade_fact where trade_id > = 210960459 > DBD::Oracle::db prepare failed: (DBD INVALID_HANDLE: > OCIStmtPrepare) at test.pl line 86. > (DBD INVALID_HANDLE: OCIStmtPrepare) at test.pl line 86. > > If I reverse the order of the two SQL statements, to prove that the 2nd > works, then > the output is as follows: > > select trade_date, host_cust_id from cm_trade_fact where trade_id > = 210960459 > Return Status: 1 > 15-MAY-01, WA181862 > BEGIN sp_exec_imm('drop index CMBUS1'); END; > DBD::Oracle::db do failed: (DBD INVALID_HANDLE: OCIStmtPrepare) > at test.pl line 109. > (DBD INVALID_HANDLE: OCIStmtPrepare) at test.pl line 109. > > Finally, if I use a completely separate database handle for the 2nd SQL > statement, > (attached is the code used for this, called test2.pl) it works: > > select trade_date, host_cust_id from cm_trade_fact where trade_id > = 210960459 > Return Status: 1 > 15-MAY-01, WA181862 > BEGIN sp_exec_imm('drop index CMBUS1'); END; > Return Status: 1