xiguaqq20 发表于 2018-9-14 09:20:18

oracle小程序-如何倒转字符串

  --取出第n个字符
  select substr('abc',,1) from dual;
  --主要思想:从字符串开头依次取出每个字符将其放到最后一个位置后用for循环语句依次连接起来
  declare
  i number :=1;
  top char(1);
  c_str_temp varchar2(20) := '&num';
  c_str_reverse varchar2(100);
  begin
  for i in 1.. length(c_str_temp)
  loop
  top:= substr(c_str_temp,i,1);
  c_str_reverse := top||c_str_reverse;
  end loop;
  dbms_output.put_line(c_str_reverse);
  end;

页: [1]
查看完整版本: oracle小程序-如何倒转字符串