PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
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

Robert:

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' )"); 
$sth->execute; 

Jayson Pifer




Robert_Gorrebeeck@concentra.com 
Sent by: owner-sybperl-l@peppler.org
01/04/2008 04:25 PM

To
sybperl-l@peppler.org
cc

Subject
Question about placeholders/variables in insert statements







All 

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, 
$value2)"); 
$sth->execute; 

Just curious is this is possible 

Thanks 

Robert Gorrebeeck
EAI Developer
Concentra
5080 Spectrum Drive, Suite 1200W
Addison, TX 75001
972.725.6956
Robert_Gorrebeeck@concentra.com 
****** CONFIDENTIALITY NOTICE ******
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 http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.