MySQL Forums
Forum List  »  Stored Procedures

Help - variable removing leading "0" in stored procedure
Posted by: John Constantine
Date: January 12, 2006 02:56AM

Hi, I've posted this in the Newbie section too, but wondered if anyone in here may be able to help? This is what I've posted. Any help really is gratefully received...

Hi everyone!!

I'm new at this but I'm just trying to write a stored procedure to do a few things for me as follows.

Basically I want to provide a mobile number to my store procedure and get it to query the db - sounds easy enough, however for the life of me I can't work out how to specify the variable in the SET command for the stored procedure to treat the mobile number as a VARCHAR etc... i.e. - for it NOT to remove the leading "0". - here is the example.... I've made the example as simple as possible and as close to the example in the stored procedure guide too.

use mydbwhatever;
DELIMITER //
CREATE PROCEDURE P1(p INT)
BEGIN
SET @x = p;
select @x ;
END;
//

The result when when I call is as follows :

mysql> call P1(01234567890)//
+------------+
| @x |
+------------+
| 1234567890 |
+------------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

AS you can see it's removed the leading 0 - I've tried specifying different things instead of INT but my suspiscion is that the problem doenst lie there, but with the SET command itself.

Can anyone help??

Many thanks,

JC.

Options: ReplyQuote


Subject
Views
Written By
Posted
Help - variable removing leading "0" in stored procedure
2077
January 12, 2006 02:56AM


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.