Greetings,

Please see following sample code and result. Note that x is cast properly but y 
isn't. (FYI 0x913386aa3cbbab5a == 10462854425033288538)

Is there a way in MySQL to convert strings to numbers such that it recognizes 
decimal, hex, and optionally other bases? I'm thinking of something like strtol 
in C/C++.

DELIMITER //
CREATE PROCEDURE GetXY()
BEGIN
    DECLARE x BIGINT UNSIGNED;
    DECLARE y BIGINT UNSIGNED;

    SET x = '10462854425033288538';
    SET y = '0x913386aa3cbbab5a';

    SELECT x, y;
END
//
DELIMITER ;

mysql> call GetXY();
+----------------------+---+
| x                    | y |
+----------------------+---+
| 10462854425033288538 | 0 |
+----------------------+---+

Thank you for reading.

Regards,

YR




      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your 
favourite sites. Download it now at
http://ca.toolbar.yahoo.com.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to