0
這裏是mycode用於在遊標中讀取15行......但是它讀取一行而不讀取15行這段代碼中的任何錯誤.ANY幫助將提前我用cursor_loop:循環在sql存儲過程中它沒有讀取所有15行只讀取一行
delimiter $$
drop procedure if exists retrieve_relstr_roc_price;
create procedure retrieve_relstr_roc_price(
in p_begin_date datetime
)
begin
declare no_more_rows boolean;
declare l_symbol varchar(10);
declare l_commit_rows int default 60;
declare l_row_num int default 0;
declare roc_value_cursor cursor for
select * from(select distinct(symbol) as symbol from
eqt_price_ta_relstr where category_name in ((select * from (select
sn.category_name from eqt_price_ta_relstr ept
inner join sectornames sn on sn.symbol = ept.symbol where ept.category_name
= "SPsector" and ept.close_date >= p_begin_date group by sn.category_name order by ept.rank5 limit 0,1) t4 )) and close_date >= p_begin_date group by symbol order by rank5 limit 15) as t1;
declare continue handler for not found set no_more_rows = true;
open roc_value_cursor;
cursor_loop: loop
fetch roc_value_cursor
into l_symbol;
if no_more_rows
then
close roc_value_cursor;
leave cursor_loop;
end if;
/*next part code used the cursor value*/
使用列名而不是*,因爲接收變量只有一個。 –
我嘗試了使用列名稱,但仍然獲取一行。 –
遊標查詢是否實際返回15個元組? – wchiquito