in reply to DBD:Oracle::db prepared error

You need to quote your strings. Either use $dbh->quote() method or use binding:
$sth = $dbv->prepare("INSERT INTO DL_SWIPE VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); $sth->execute($row[0], $row[1], $row[2],$row[3],$row[4],$row[5],$row +[6],$row[7], $row[8],$row[9],$row[10],$row[11],$row[12],$row[13],$row[14],$row[15], +$row[16], $row[17],$row[18])"); # update: the line above can be changed to # $sth->execute(@row); # if @row has exactly 18 elements
see the DBI documentation for more info.

Also, you'll be in a ton of sh*t if the order of your columns ever changes. It's probably a good idea to name your columns in that prepare() statement.

Joost

Replies are listed 'Best First'.
Re^2: DBD:Oracle::db prepared error
by dragonchild (Archbishop) on Aug 20, 2004 at 00:49 UTC
    my $qmark = join(',', ('?') x @row); $sth = $dbv->prepare( "INSERT INTO DL_SWIPE VALUES( $qmark )" ); $sth->execute( @row );

    Much easier to read and maintain. You knew that ...

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

      $dbv->do("INSERT INTO DL_SWIPE VALUES( $qmark )",undef,@row);
      You knew that...

      rdfield

        *laughs* Actually, I never use do(), preferring to always prepare_cached() as I'm usually in a persistent environment reusing the same queries over and over.

        But, touche! :-)

        ------
        We are the carpenters and bricklayers of the Information Age.

        Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

        I shouldn't have to say this, but any code, unless otherwise stated, is untested

Re^2: DBD:Oracle::db prepared error
by freddo411 (Chaplain) on Aug 19, 2004 at 22:38 UTC
    Just to add a little more detail to Joost's comment:

    create an array of column names (if columnnames in DB1 eq columnnames in DB2) , then use that array to build the select and load statements.

    If columnnames in DB1 ne columnnames in DB2 then use a hash to show the correspondance and build the select and load statements from the keys/values of the hash.

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday