MySQL Forums
Forum List  »  Optimizer & Parser

Access mysql blob data from stored procedure
Posted by: Kalpesh g
Date: April 15, 2014 04:38AM

Hi

I have one friend table which stores all the users id who are friend of user in blob column.

I want to ask if these is right method or not.

I was trying to write stored procedure which converts blob data type to char by cast. But i can not access string to split by separator as it is in char.

Code for stored procedure is below:

CREATE PROCEDURE `string_procedure`()
BEGIN
DECLARE name_val VARCHAR(255);
DECLARE status_update_val VARCHAR(255);

-- Declare variables used just for cursor and loop control
DECLARE no_more_rows BOOLEAN;
DECLARE loop_cntr INT DEFAULT 0;
DECLARE num_rows INT DEFAULT 0;
DECLARE friends_cur cursor for SELECT CAST(friend_id AS CHAR(10000) CHARACTER SET utf8) as name_val FROM `friend` WHERE `friend_id` = '2';


DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_rows = TRUE;
OPEN friends_cur;
the_loop: LOOP

FETCH friends_cur INTO name_val;

IF no_more_rows THEN
CLOSE friends_cur;
LEAVE the_loop;
END IF;

select name_val;


END LOOP the_loop;
END

Options: ReplyQuote


Subject
Views
Written By
Posted
Access mysql blob data from stored procedure
2819
April 15, 2014 04:38AM


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.