在C#中,我們可以這樣轉換:
int a=203;
char b=(char)a;
label1.text=b.toString();
現在我需要把這段算法用procedures完成,這個時候問題就來了,在procedures裏面,轉換的卻是一個為空的字符,而單純用
select chr(203) from dual,卻又沒問題,這裡大蝦多,望知道的弟兄點撥小弟一下:
代碼如下:
ROCEDURE CLS_CODE128A
( p_code IN varchar2,
r_code out varchar2)
IS
code128aStart_int number;
code128aStop_int number;
code128aStart_char char;
code128aStop_char char;
code128aCheck char;
WeightedTotal number;
p_code_length number;
icurrentchar number;
BEGIN
r_code :='';
code128aStart_int:=203;
code128aStop_int:=206;
WeightedTotal:=code128aStart_int-100;
select chr(203) into code128aStart_char from dual;
--dbms_output.put_line(code128aStart_char);
select chr(206) into code128aStop_char from dual;
WeightedTotal:=code128aStart_int-100;
p_code_length:=length(p_code);
for idx in 1..p_code_length loop
icurrentchar:=ascii(substr(p_code,idx,1));
--dbms_output.put_line(icurrentchar);
if icurrentchar <135 then
icurrentchar :=icurrentchar-32;
else if icurrentchar >134 then
icurrentchar :=icurrentchar-100;
end if;
end if;
WeightedTotal:=WeightedTotal+(icurrentchar*(idx+1));
end loop;
icurrentchar :=mod(WeightedTotal,103);
if icurrentchar <95 and icurrentchar >0 then
icurrentchar :=icurrentchar+32;
else if icurrentchar >94 then
icurrentchar :=icurrentchar+100;
else if icurrentchar=0 then
icurrentchar :=194;
end if;
end if;
end if;
code128aCheck:= chr(icurrentchar);
for idx1 in 1..p_code_length loop
if substr(p_code,idx1,1)=chr(194) then
r_code:=r_code||chr(194);
else
r_code:=r_code||substr(p_code,idx1,1);
end if;
end loop;
r_code:=code128aStart_char||r_code||code128aCheck||code128aStop_char;
EXCEPTION
WHEN others THEN
r_code:='ERR';
END; -- Procedure
int a=203;
char b=(char)a;
label1.text=b.toString();
現在我需要把這段算法用procedures完成,這個時候問題就來了,在procedures裏面,轉換的卻是一個為空的字符,而單純用
select chr(203) from dual,卻又沒問題,這裡大蝦多,望知道的弟兄點撥小弟一下:
代碼如下:
ROCEDURE CLS_CODE128A
( p_code IN varchar2,
r_code out varchar2)
IS
code128aStart_int number;
code128aStop_int number;
code128aStart_char char;
code128aStop_char char;
code128aCheck char;
WeightedTotal number;
p_code_length number;
icurrentchar number;
BEGIN
r_code :='';
code128aStart_int:=203;
code128aStop_int:=206;
WeightedTotal:=code128aStart_int-100;
select chr(203) into code128aStart_char from dual;
--dbms_output.put_line(code128aStart_char);
select chr(206) into code128aStop_char from dual;
WeightedTotal:=code128aStart_int-100;
p_code_length:=length(p_code);
for idx in 1..p_code_length loop
icurrentchar:=ascii(substr(p_code,idx,1));
--dbms_output.put_line(icurrentchar);
if icurrentchar <135 then
icurrentchar :=icurrentchar-32;
else if icurrentchar >134 then
icurrentchar :=icurrentchar-100;
end if;
end if;
WeightedTotal:=WeightedTotal+(icurrentchar*(idx+1));
end loop;
icurrentchar :=mod(WeightedTotal,103);
if icurrentchar <95 and icurrentchar >0 then
icurrentchar :=icurrentchar+32;
else if icurrentchar >94 then
icurrentchar :=icurrentchar+100;
else if icurrentchar=0 then
icurrentchar :=194;
end if;
end if;
end if;
code128aCheck:= chr(icurrentchar);
for idx1 in 1..p_code_length loop
if substr(p_code,idx1,1)=chr(194) then
r_code:=r_code||chr(194);
else
r_code:=r_code||substr(p_code,idx1,1);
end if;
end loop;
r_code:=code128aStart_char||r_code||code128aCheck||code128aStop_char;
EXCEPTION
WHEN others THEN
r_code:='ERR';
END; -- Procedure
解决方案 »
- 疑难问题!oralce 多个hsodbc.exe不释放如何解决?
- 谁知道wavecom短信猫连接oracle的配置么? 网上全都是sqlserver和access的,求oracle的啊!!
- ORACLE 存储过程 回滚操作
- 寻找sqlserver存储过程转为 oracle存储过程的工具
- 关于递归树转换关系树的问题
- sql loader导数据时如何添加序号?
- 请问oracle 9i中 float类型 和number类型
- 在PL/SQL Devoloper的SQL Window中如何一次执行多条SQL语句
- 如何中断一个ADO查询?(100分)请教了,谢谢!
- 请问日期格式
- 请高手帮看看,优化一条简单查询的sql语句
- 今天没答上的两道数据库开发试题
你要的是这个么?