小编mel*_*ira的帖子

ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小

我尝试了以下代码的不同方式,比如取出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;
/
Run Code Online (Sandbox Code Playgroud)

错误:

ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line …
Run Code Online (Sandbox Code Playgroud)

sql oracle plsql if-statement while-loop

31
推荐指数
2
解决办法
41万
查看次数

标签 统计

if-statement ×1

oracle ×1

plsql ×1

sql ×1

while-loop ×1