Oracle PL/SQL - メモ - 集計関数 + カーソルAdvertisement集計関数 + カーソル
declare
cursor cur_kihon is
select max(数量) from pxm70101
where 商品コード = '000';
rec_kihon cur_kihon%rowtype;
wk_count integer;
begin
open cur_kihon;
fetch cur_kihon into rec_kihon;
-- false になる。
if cur_kihon%found then
null;
end if;
close cur_kihon;
-- 取得できる。
select max(数量) into wk_count
from pxm70101
where 商品コード = '000';
end;
カーソル内で集計結果を検索する場合、fetch - if cur_kihon%found の結果は false になるので注意。Advertisement |
ショートカット・634・このカテゴリのトップページに戻る ・634labs UIコレクションギャラリー サイト検索Y!ログール |