Go Back  IT Forums > Software > Informix
User Name
Password
Reply
 
Thread Tools Search this Thread Display Modes

CAST in SPL from NVARCHAR[1] to INT
  #1
Old 10-12-2006, 07:38 AM
Alan Treece \(atreece\)
Junior Member


Alan Treece \(atreece\) is offline
Alan Treece \(atreece\)'s Info
Join Date: Oct 2006
Posts: 1
Default CAST in SPL from NVARCHAR[1] to INT


Has anyone done this. I'm trying to get the numeric representation of a
unicode character.

DEFINE vpos int;
DEFINE vUnicodeStr NVARCHAR(128);
DEFINE vUnicodeValue int;
DEFINE vUniChar NVARCHAR(1);
DEFINE pFirstName varchar(64);

LET vpos = 1;
LET pFirstName = 'Alan';
LET vUnicodeStr = CAST(pFirstname AS NVARCHAR(128));
LET vUniChar= SUBSTR(vUnicodeStr, vpos, 1);
LET vUnicodeValue = CAST(vUniChar AS INT);

The last line generates this error. The docs talk about CAST only
working when the internal storage is the same. Otherwise a cast support
function is needed. I haven't found much on cast support functions that
would help me write one yet.



1213: Character to numeric conversion error
Error in line 1
Near character position 1

[root@nw096a-82 root]# finderr 1213
-1213 A character to numeric conversion process failed.

A character value is being converted to numeric form for storage in a
numeric column or variable. However, the character string cannot be
interpreted as a number. It contains some characters other than white
space, digits, a sign, a decimal, or the letter e; or the parts are in
the wrong order, so the number cannot be deciphered.

If you are using NLS, the decimal character or thousands separator
might be wrong for your locale.

Any ideas appreciated,

Alan
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Style Design by vBStyles.com


Top Contact Us - IT Forums - Archive - MyLounge Top
MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service