MySQL Forums
Forum List  »  Stored Procedures

multiple output from store procedure
Posted by: vova vv
Date: February 07, 2009 03:58PM

Hello to ALL!!
I have a store procedure which consists from several 'select' and 'if' statments.
So the structure is:

CREATE DEFINER= ...... PROCEDURE `test`(
in arg_1 INTEGER,
in arg_2 INTEGER
)
BEGIN
DECLARE artisan VARCHAR(15);
DECLARE town VARCHAR(35);
DECLARE tel CHAR(16);
DECLARE tel_1 VARCHAR(20);
DECLARE podelka VARCHAR(15);
DECLARE img VARCHAR(255);
DECLARE cost SMALLINT(6);
DECLARE about VARCHAR(255);


SELECT
CFID, Name, City, Fone, Ad_fone, Art_name, Art_foto, Art_price, About_art INTO id, artisan, town, tel, tel_1, podelka, img, cost, about
FROM art INNER JOIN pers_inf
ON art.Person_id=pers_inf.Person_id
WHERE Art_id = arg_art_id;

SELECT
.....
FROM
.....
WHERE

IF... AND i...THEN
INSERT INTO ...
VALUES ..
UPDATE ....
SET ...
WHERE ....
END IF;

SELECT artisan,town,tel,tel_1,podelka,img,cost,about;
END


The problem is that I need to output the results from my FIRST SELECT - it's always 1 row. So I have to declare a lot of variables at the beginning, and I also have to put additional
SELECT artisan,town,tel,tel_1,podelka,img,cost,about - at the end

I suppose that -it's a hard recourse-intensive way.
How do it wright???

Thanks for your comments, answers!!!

Options: ReplyQuote


Subject
Views
Written By
Posted
multiple output from store procedure
2753
February 07, 2009 03:58PM


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.