I'm not entirely sure what you're experiencing, but don't you need data types
for (2) and (3)?  Perhaps MySQL defaults to INT, but I'm not sure.

Check out http://www.mysql.com/doc/en/String_functions.html for more info, but
look into the above item first.  I have a sneaking suspicion that's your
problem.

Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message -----
From: "Hu Qinan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, 03 June, 2003 03:05
Subject: Constants required in String functions?


Dear all,

I am wondering whether constant arguments are required in string functions, e.g.

Substring(str, pos, len).

Given MyTable:
    ...
    MyString  TEXT,                                            (muti-byte
characters)
    MyPos     UNSIGNED(10),
    MyLength UNSIGNED(10).

While (1) works well, (2) would return strange characters.

(1)SELECT SUBSTRING(MyString, 1, 1)

(2) SELECT SUBSTRING(MyString, MyPos, MyLength)
FROM MyTable

What's wrong with SQL (2)?



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

Reply via email to