0

Hi,
I am learning store procedure.

my table structure is
user_id int(9) primary
user_name varchar(100)
user_first_name varchar(100)

CREATE PROCEDURE Sp1(OUT p VARCHAR(100),OUT p1 VARCHAR(100),IN p2 INT)
SELECT user_name,user_first_name INTO p,p1 FROM pm_user WHERE user_id=p2;

CALL Sp1(@Name,@Fname,2);

SELECT @Name,@Fname;

Output comes like
@Name @Fname
[BLOB - 0B] [BLOB - 0B]

How to get correct output?

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by smantscheff
0

On my system the output is correct:

drop table if exists pm_user;
create table pm_user (
user_id int(9) primary key,
user_name varchar(100),
user_first_name varchar(100)
);
insert into pm_user values (
2, 'theName', 'theFirstName' 
);

drop procedure if exists Sp1;
CREATE PROCEDURE Sp1(OUT p VARCHAR(100),OUT p1 VARCHAR(100),IN p2 INT)
SELECT user_name,user_first_name INTO p,p1 FROM pm_user WHERE user_id=p2;

CALL Sp1(@Name,@Fname,2);

SELECT @Name,@Fname;
+---------+--------------+
| @Name   | @Fname       |
+---------+--------------+
| theName | theFirstName |
+---------+--------------+

Which interface do you use? Command line mysql? Or phpMyAdmin? Or what?

0

If you are in training, use the mysql command line. phpMyAdmin can tweak queries and results. As far as I know, command line mysql is the only interface which does no relevant post-processing on the mysql output (except result formatting) so that you can see exactly what the mysql server is telling you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.