From: Dave W Cottrell [mailto:[EMAIL PROTECTED]
> On 4/18/05, Bowie Bailey <[EMAIL PROTECTED]> wrote:
> > From: Dave W Cottrell [mailto:[EMAIL PROTECTED]
> > > 
> > > The code:
> > > $sql = qq{insert into ppp_admin.$table_name ('$columns') values
> > >           ('$result') };
> > > $sth_prod = $dbh_prod->prepare($sql) || die $dbh_prod->errstr;
> > > $sth_prod->execute();
> > > $sth_prod->finish()  || die $dbh_prod->errstr;.
> > >
> > > The $columns and $result are coma delimited strings.  The error occurs
> > > on the 'execute'.
> > >
> > > DBD::ODBC::st execute failed: [Oracle][ODBC][Ora]ORA-00928:
> > > missing SELECT keyword
> > >
> > > I might note that this script works fine using DBI and on a unix
> > > platform and the folloiwng connect.
> > > $dbh_prod = DBI->connect(
> > > "dbi:Oracle:host=$db_p_server;sid=$db_p_sid;port=$db_p_port",
> > > $db_p_user, $db_p_password) || die "Connect Error";
> > >
> > > When I changed to ODBC and Windows, the problem surfaced.
> > > $dbh_prod = DBI->connect( 'DBI:ODBC:DSN, $username, $password)
> > > or die "Can't connect to $Prod_data_source: $DBI::errstr";
> > 
> > I don't see anything wrong with it.  Maybe windows doesn't like using
> > prepare/execute with an insert.  Try this instead:
> > 
> > $sql = qq{insert into ppp_admin.$table_name ('$columns') values
> >           ('$result') };
> > $dbh_prod->do($sql) || die $dbh_prod->errstr;
> 
> Replacing this :
> $dbh_prod->prepare($sql) || die $dbh_prod->errstr;
> 
> with :
> $dbh_prod->do($sql) || die $dbh_prod->errstr;
> 
> crashes the script.

What did the crash say?

Did you just replace that one line?  The code piece I gave you should have
completely replaced the one you provided.  There is no execute and no
finish.

Instead of:
  $sth = $dbh->prepare($sql);
  $sth->execute;
  $sth->finish

You have:
  $dbh->do($sql);

Bowie
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to