Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Insert error
MattJ83 wrote on 20.09.2006 12:24:
> Hi,
>
> Im having some trouble with my insert statement. Im using TOAD and my
> code has been written in PERL.
>
> Insert statement:
>
> $dbh->do ("INSERT INTO TEST4 (log_name, db_no, updates, deletions,
> fastsearch, error) VALUES
> (TO_DATE(SUBSTR('$filename',1,INSTR('$filename','_')-1),
> 'YYYYMMDDHH24'),
> SUBSTR('$filename',INSTR('$filename','_')+1,INSTR('$filename','_')-8),
> $update, $deletion, $elapsed, $fast)");
>
> The statement works fine when $fast is replaced by 'text' and when it
> is left out. $fast has text data in it. The error is:
>
> DBD::Oracle::db do failed: ORA-00917: missing comma (DBD ERROR:
> OCIStmtExecute) [for statement ``INSERT INTO TEST4 (log_name, db_no,
> updates, deletions, fastsearch, error) VALUES
> (TO_DATE(SUBSTR('2006090603_103_fs.log',1,INSTR('2006090603_103_fs.log','_')-1),
> 'YYYYMMDDHH24'),
> SUBSTR('2006090603_103_fs.log',INSTR('2006090603_103_fs.log','_')+1,INSTR('2006090603_103_fs.log','_')-8),
> 0, 0, 2, Updating pending FASTSEARCH for MOLSTRUCTURE
> )'']) at ./test10.pl line 55.
>
> I have checked my single/double quotes and checked my brackets.
> i don't think my problem is with the PERL code because it is reading:
> 'Updating pending FASTSEARCH for MOLSTRUCTURE' .
>
> Any help would be great.
>
It's hard to read, as the code is not formatted at all, but I would think that
you have to quote the contents of $fast even though it it contains quotes. At
least that's what the error message indicates in my opinion.
But then I don't know Perl at all, so I can't say how the $dbh->do() is handling values that have qutoes.
Thomas Received on Wed Sep 20 2006 - 05:29:00 CDT