Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: jayson dot x dot pifer at jpmchase dot com
Subject: Re: Question about placeholders/variables in insert statements
Date: Jan 4 2008 9:59PM


Just reading what you wrote, do you have a string that you are inserting 
or is there more to the story?  If so then you should quote it like so:

$sth=$sbh->prepare("INSERT INTO table (column1, column2) VALUES ( 
'$value1', '$value2' )"); 

Jayson Pifer 
Sent by:
01/04/2008 04:25 PM


Question about placeholders/variables in insert statements


I have a question regarding Insert statements using placeholders. 

Is it possible to replace the placeholders with variables? 
I have tried and it gives me the following error : 
        DBD::Sybase::st execute failed: Server message number=128 
severity=15 state=1 line=1 text=The name 'U' is illegal in this context. 
Only constants, constant expressions, or         variables allowed here. 
Column names are illegal. 

So for example from this: 

$sth=$dbh-prepare("INSERT INTO table (column1, column2) VALUES (?,?)"); 
$sth->execute($value1, $value2); 

to this: 

$sth=$sbh->prepare("INSERT INTO table (column1, column2) VALUES ($value1, 

Just curious is this is possible 


Robert Gorrebeeck
EAI Developer
5080 Spectrum Drive, Suite 1200W
Addison, TX 75001
NOTICE: This e-mail message and all attachments transmitted with it may 
contain legally privileged and confidential information intended solely 
for the use of the addressee. If the reader of this message is not the 
intended recipient, you are hereby notified that any reading, 
dissemination, distribution, copying, or other use of this message or its 
attachments is strictly prohibited. If you have received this message in 
error, please notify the sender immediately and delete this message from 
your system. Thank you.

This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to for
disclosures relating to UK legal entities.