MySQL Forums
Forum List  »  Stored Procedures

binary value handling
Posted by: scott
Date: October 29, 2005 10:35AM

hi, I have a question regarding how mysql handles the binary value

I have a table that is declared as follows:

create table objects ( id binary(16), name varchar(32));

I insert a row to the table using the following sql:

insert into objects values( binary('1'), 'obj1');

now, I try to select this row using the following syntax, and it does not work

mysql> select * from objects where id = binary('1');
Empty set (0.02 sec)

so, using binary('1') as key does not work

so, I tried to the same sql without the single quotes, and it worked.

select * from objects where id = 1;


now, if I try to put the sql inside a stored procedure like the following, no matter what value i pass in, it does not work

CREATE PROCEDURE 'list` (pid binary(16))
BEGIN
select * from objects where id = pid;
END

I tried the following, none of them returns anything
call list(1);
call list(binary('1'));
call list('1');

Question, can someone explain how mysql handles binary vlaues, how come we can have seeming random resutls? Is this a bug? I am using 5.0 production release.

thanks

Options: ReplyQuote


Subject
Views
Written By
Posted
binary value handling
3074
October 29, 2005 10:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.