PL/SQL查询条件中使用like操作实例

set serveroutput on

declare

type ref_trans is ref cursor;

tranref ref_trans;

v_trns emp%rowtype;

str varchar2(200);

–v_channel varchar2(50);

letter char:= ‘a’;

begin

loop

str := ‘select channel from bphadmin.emp where channel like ”’||letter||’%”’;

open tranref for str;

loop

fetch tranref into v_trns.channel;

exit when tranref%notfound;

dbms_output.put_line(v_trns.channel);

end loop;

exit when letter=’z’;

letter:= chr(ascii(letter)+1);

end loop;

end;

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐