PLSQL 查询条件中使用 like

xiaoxiao2021-02-28  36

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;
转载请注明原文地址: https://www.6miu.com/read-2620047.html

最新回复(0)