1. always have 
 use strict;
 use warnings; 
at the top of your program to trap any perl syntax errors - eg you declared
$go twice

2. At least have PrintError on (preferably RaiseError) to trap any Oracle
errors, as your insert command is incorrect syntax

3. Look at using placeholders rather than strings in your sql statement
(though not strictly necessary)

4. If you are still having problems, maybe try the SQl in SQLPlus to see if
the problem persists.  It could be lack of an index (if updating a big
table) or a locking problem which could prevent the update from happening

5. As you have AutoCommit off, don't forget to commit before you disconnect

Michael Fox

-----Original Message-----
From: Sharma, Amit [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 26 August 2003 12:18 AM
To: [EMAIL PROTECTED]
Subject: Strange Update SQL problem - DBD ERROR: OCIStmtExecute 



        Hi Again, 

        I think I did not completely described the problem. Please ignore my
last mail on it.

        I am trying to insert and update a record set in Oracle database.
Though the insert works perfectly fine, the update sql doesn't return back.
And when I try to interrupt the program by pressing CTRL+C, am getting the
following error: ORA-01013: user requested cancel of current operation (DBD
ERROR: OCIStmtExecute)


        Could anybody help me with this issue am facing. Here is main code
section pasted below.


        my $dbHandle = DBI->connect( 'dbi:Oracle:' . $DBName
                                  , $DBUser
                                  , $DBPassword
                                , { PrintError => 0, AutoCommit => 0 }
                                );

        $stmt="insert into add user_attribute values(\'testingamit\') where
domain=\'gome\' and name=\'henry\' and attribute_name=\'comment\'";


        my $go = $dbHandle->prepare($stmt);
        $go->execute();

        print "done insertion\n";

        print "Now Update \n";

        $stmt = "update user_attribute set attribute_value='testingamit'
where domain='gome' and name='henry' and attribute_name=\'comment'";

        my $go = $dbHandle->prepare($stmt);
        $go->execute || die "execute: $$stmt: $DBI::errstr";


        Thanx a lot,
        A.S.



Australia Post is committed to providing our customers with excellent service. If we 
can assist you in any way please either telephone 13 13 18 or visit our website 
www.auspost.com.au.

CAUTION

This e-mail and any files transmitted with it are privileged and confidential 
information intended for the use of the addressee. The confidentiality and/or 
privilege in this e-mail is not waived, lost or destroyed if it has been transmitted 
to you in error. If you have received this e-mail in error you must (a) not 
disseminate, copy or take any action in reliance on it; (b) please notify Australia 
Post immediately by return e-mail to the sender; and (c) please delete the original 
e-mail.

Reply via email to