日期:2014-05-17 浏览次数:20898 次
SELECT mod(substr('2378',1,1)+4,10)
------解决方案--------------------
mod(substr('2378',2,1)+4,10)
------解决方案--------------------
mod(substr('2378',3,1)+4,10)
------解决方案--------------------
mod(substr('2378',4,1)+4,10)
FROM dual;
SELECT mod(substr('2378',1,1)+5,10)
------解决方案--------------------
mod(substr('2378',2,1)+5,10)
------解决方案--------------------
mod(substr('2378',3,1)+5,10)
------解决方案--------------------
mod(substr('2378',4,1)+5,10)
FROM dual;
create or replace function test_ff(in_num in varchar2,in_str varchar2)
return varchar2 is
v_ret varchar2(100);
begin
if in_num = '1' then
SELECT mod(substr(in_str, 1, 1) + 4, 10)
------解决方案--------------------
mod(substr(in_str, 2, 1) + 4, 10)
------解决方案--------------------
mod(substr(in_str, 3, 1) + 4, 10)
------解决方案--------------------
mod(substr(in_str, 4, 1) + 4, 10) into v_ret
FROM dual;
elsif in_num = '2' then
SELECT mod(substr(in_str, 1, 1) + 5, 10)
------解决方案--------------------
mod(substr(in_str, 2, 1) + 5, 10)
------解决方案--------------------
mod(substr(in_str, 3, 1) + 5, 10)
------解决方案--------------------
mod(substr(in_str, 4, 1) + 5, 10) into v_ret
FROM dual;
else
v_ret :='It is wrong key';
end if;