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: Khanh-Linh Huynh <linh dot huynh at mci dot com>
Subject: Re: convert from char to int
Date: Nov 16 1998 4:51PM

Thanks, Michael.  The problem is $col1 has to be in quotes when converting from 
char to int:
	a = convert(int, "$col1") 

On Mon, 16 Nov 1998 06:23:11 -0800 (PST) Michael Peppler  
wrote:

> 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
>