declare
  str varchar2(100):=null;
  now_str varchar2(10):=null;
  len number:=0;
  res varchar2(20):=null;
begin
  str := '空有123ABC' ;
  for i in 1..length(str) loop
    now_str := substr(str,i,1);
    if lengthb(now_str)<>1 then
      res := '多字元;
    else
      res := '單字元';
    end if;        
    SYS.DBMS_OUTPUT.PUT_LINE(now_str|| '-' ||res || '=' || lengthb(now_str)  );
  end loop;
end;
------------------------------
空-多字元=3
有-多字元=3
1-單字元=1
2-單字元=1
3-單字元=1
A-單字元=1
B-單字元=1
C-單字元=1

arrow
arrow
    全站熱搜

    Nolem 發表在 痞客邦 留言(1) 人氣()