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: Michael Peppler <mpeppler at MBAY dot NET>
Subject: convert from char to int
Date: Nov 16 1998 2:23PM

Khanh-Linh Huynh writes:
 > I'm writing a cgi app to do updating to the database using sybperl.  Since perl 
 > regards everything as string, my int field does not get updated.
 > 
 > The below code gave me an "Implict conversion from datatype 'varchar' to 
 > 'numeric'" error.
 > 
 > $col1 = contents{'col1'} ;
 > ....
 > 	update table1
 > 	set
 > 		a = convert(int, $col1)
 > 	where a = $aa

You're running into some other problem.

e.g.

$a = 77;
$aa = 80;
$dbh->dbcmd("update table1 set a = $a where a = $aa");

will work just fine.

What is the definition of table1, and what is the exact content of
$contents{col1} and $aa?

Michael
--
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@mbay.net       -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com