我尝试了以下代码的不同方式,比如取出while或if,但是当我把它们放在一起时(if和while),我总是得到错误…
undefine numero set serveroutput on accept numero prompt 'Type # between 100 and 999: ' declare i number:=1; a char(25); b char(1); c varchar2(10); d number; begin c := № d := length(c); b := substr(c,i,1); while i <= d loop if b = '1' then a:= a||'one '; end if; i := i+1; end loop; dbms_output.put_line('The number is '||a); end; /
错误:
ORA-06502: PL/sql: numeric or value error: character string buffer too small ORA-06512: at line 13 06502. 00000 - "PL/sql: numeric or value error%s"
通过更改我将变量“a”声明为:
a varchar2(2000);