简体   繁体   English

ORA-06502:PL / SQL:数字或值错误:数字精度太大

[英]ORA-06502: PL/SQL: numeric or value error: number precision too large

I'm trying to run the following insert command in Oracle SQL Developer: 我正在尝试在Oracle SQL Developer中运行以下插入命令:

insert into work_comp_rates (company_id, work_comp_rt)
values ('101', 0.11);

Which gives me this error: "ORA-06502: PL/SQL: numeric or value error: number precision too large" 这给了我这个错误:“ ORA-06502:PL / SQL:数字或值错误:数字精度太大”

There is a trigger attached: 附加了一个触发器:

create or replace 
TRIGGER APPS.work_codes_trig
before insert or update ON APPS.WORK_COMP_RATES for each row
begin
  if inserting then
    if :NEW.RID is null then
      :NEW.RID := it_api.gen_pk;
    end if;
    :NEW.CREATED_ON := sysdate;
  end if;
  if updating then
    :NEW.MODIFIED_ON := sysdate;
  end if;
end;

If I replace 如果我更换

:NEW.RID := it_api.gen_pk; 

with

:NEW.RID := 599;

the insert statement works. 插入语句起作用。

IT_API Body: IT_API正文:

create or replace
package body it_api
as
-- generates and returns unique number used for primary key values
function gen_pk
return number
is
l_pk number := 0;
begin
for c1 in (
select to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') pk
from dual )
loop
l_pk := c1.pk;
exit;
end loop;
return l_pk;
end gen_pk;
end it_api;

I don't know Oracle very well and that script was written by somebody else. 我不太了解Oracle,该脚本是由其他人编写的。 So any help is appreciated! 因此,任何帮助表示赞赏!

I created a sequence rate_seq that increments values by 1 and replaced 我创建了一个序列rate_seq,将值加1并替换了

:NEW.RID := it_api.gen_pk; 

with

select rate_seq.nextval
into :new.rid
from dual;

That fixed the problem. 这解决了问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL错误:ORA-06502:PL / SQL:数字或值错误 - SQL Error: ORA-06502: PL/SQL: numeric or value error 奇怪的ORA-06502:PL / SQL:数字或值错误 - Strange ORA-06502: PL/SQL: numeric or value error ORA-06502: PL/SQL: 连接时出现数字或值错误 - ORA-06502: PL/SQL: numeric or value error when concatenating ORA-06502:PL / SQL:数字或值错误:Oracle SQL查询中的字符串缓冲区太小 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Oracle sql query Oracle数据库错误:ORA-06502:PL / SQL:数字或值错误:字符串缓冲区太小 - Oracle Database Error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06502:PL/SQL:数字或值错误:字符串缓冲区太小,只有三个数字 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small only three numbers ORA-06502: PL/SQL: 数字或值错误: 原始变量长度太长 - ORA-06502: PL/SQL: numeric or value error: raw variable length too long ORA-06502: PL/SQL: 数字或值错误: 字符串缓冲区太小: 构建时 model - ORA-06502: PL/SQL: numeric or value error: character string buffer too small: When building a model 获取ORA-06502:PL / SQL:数字或值错误:SQL触发器中的字符到数字转换错误 - Getting ORA-06502: PL/SQL: numeric or value error: character to number conversion error in SQL trigger
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM