Replacing this :
$dbh_prod->prepare($sql) || die $dbh_prod->errstr;

with :
$dbh_prod->do($sql) || die $dbh_prod->errstr;

crashes the script.

On 4/18/05, Bowie Bailey <[EMAIL PROTECTED]> wrote:
> From: Dave W Cottrell [mailto:[EMAIL PROTECTED]
> > On 4/18/05, Bowie Bailey <[EMAIL PROTECTED]> wrote:
> > > From: Dave W Cottrell [mailto:[EMAIL PROTECTED]
> > > >
> > > > I'm connecting to an Oracle database, using ODBC and
> > > > Oracle's drivers.
> > > > 'SELECT' is returning records, however, 'INSERT' is producing the
> > > > following error.
> > > >
> > > > DBD::ODBC::st execute failed:
> > > > [Oracle][ODBC][Ora]ORA-00928: missing
> > > > SELECT keyword
> > > >
> > > > The INSERT keyword is not being recognized. Why?
> > >
> > > Mind::Reader not installed.  :)
> > >
> > > Post the code for the insert that is causing the problem.
> >
> > 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'.
> >
> > 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;
> 
> Bowie
> _______________________________________________
> ActivePerl mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

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

Reply via email to