MySQL Forums
Forum List  »  Stored Procedures

Which is best way for optimize performance of the query while using in Stored Procedure
Posted by: KARTHIKEYAN T
Date: December 31, 2015 12:12AM

Dear Team,
Which is the best way to get multiple rows as result of the query used within the stored procedure code block.For Example below stored procedure

create procedure sample1(in ip_one varchar(10),in ip_two varchar(10))
read sql
begin
select col3 from sam_table1 where col1=ip_one and col2=ip_two;
end;
/* this procedure returns multiple rows as result while execution*/

create procedure sample2(in ip_one varchar(10),in ip_two varchar(10),out op_one)
read sql
begin
select col3 from sam_table1 where col1=ip_one and col2=ip_two into op_one;
end;

call sample2('chennai','gah',@op_one);
select @op_one;

/* This procedure call statements returns error as
Error Code: 1172
Result consisted of more than one row*/

Kindly help me to get same result given by sample1 procedure and how can i optimize the performance of the procedure

Options: ReplyQuote


Subject
Views
Written By
Posted
Which is best way for optimize performance of the query while using in Stored Procedure
2264
December 31, 2015 12:12AM


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.