Hi Anirban

I recently suggested to you 2 very good resources for these sort of questions. 
I really recommend you use them as you will find answers much more forthcomming.

The problem you have is a common problem where numbers with leading 0's are 
interpreted as octal numbers. To solve this, the number can be reformatted to 
remove the 0's . The method recommended on the Tcl'ers Wiki is to use the scan 
command.

e.g.

scan $prv_rd %d prv_rd
set calc [expr $prv_rd+2]

Lawrence

> 
> From: "Anirban Sarkar" <[EMAIL PROTECTED]>
> Date: 2005/01/28 Fri AM 08:25:54 GMT
> To: <[email protected]>
> Subject: [sqlite] Expr error in TCL
> 
> The $prv_rd variable stores backend sqlite data (varchar data type). The data 
> is 0000874. In order to perform any mathematical operation on this data, I 
> use :
> 
> set calc [expr $prv_rd+2]
> 
> The above expression gives me the following error message :
> 
> Error : expected integer but got "0000874" ( looks like invalid octal number )
> 
> How do I get rid of this error?
> Any early help will be appreciated.
> 
> Thanks.
> Anirban Sarkar
> 

-----------------------------------------
Email provided by http://www.ntlhome.com/


Reply via email to