> I am on the very last step of my Perl script.  Have read a 
> bunch of records
> into arrays, using a 'select table handler' with DBI.  Now I 
> want to cycle
> back through the data in those arrays, and based on the value of one
> specific field, update a field in the corresponding database record.
> 
> Because I need to use one of the array elements as part of 
> the WHERE clause
> of the UPDATE statement, I built the SQL statement in a 
> scalar first, then
> passed that scalar to the "$dbh->do()" command, as follows.  
> (Due to the
> nature of the error message, I'm going to use exact table and 
> var names):
> 
>       $sql_cmd = "\"UPDATE Chunkmail SET Contribute_flag=1 WHERE
> Chunkmail_ID=" . @contribute_flag[$_] . "\"";

Why have you put extra double quotes around the entire statement?

This makes the whole statement a quoted identifier, which when it exceeds 30
characters raises ORA-00972.

Remove the occurrences of \" from your assignment to $sql_cmd.

(Also: use bind variables/placeholders. Don't interpolate variables directly
into an SQL statement string - this leads to security and scalability
issues).

 The use of @contribute_flag[$_] doesn't look right anyway - don't you mean
$contribute_flag[$_] ?

-- 
Andy Hassall <[EMAIL PROTECTED]> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space> 

Reply via email to