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?

Recommended Answers

All 3 Replies

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?

Hi i am using phpMyAdmin

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.