# ORA-01422 exact fetch returns more than requested number of rows
1 2 3 4 5
--查询到 per_box_qty 是多条记录 select per_box_qty into l_box_num from som_packing_item_setup where organization_id = p_org_id and assembly_item_id = p_item_id;
# ORA-01427: single-row subquery returns more than one row
1 2 3 4 5 6 7 8 9 10 11 12 13 14
declare e_single_row_subq exception; pragma exception_init(e_single_row_subq, -1427); l_ename varchar2(100); begin select (select ename from scott.emp) into l_ename from dual; exception when too_many_rows then dbms_output.put_line('too_many_rows'); when e_single_row_subq then dbms_output.put_line('ORA-01427: single-row subquery returns more than one row'); end; -- ORA-01427: single-row subquery returns more than one row
1 2 3 4 5 6 7 8 9 10 11
declare l_ename varchar2(100); begin select (select ename from scott.emp) into l_ename from dual; exception when others then if sqlcode =-1427then dbms_output.put_line('ORA-01427: single-row subquery returns more than one row'); end if; end; --ORA-01427: single-row subquery returns more than one row
# ORA-06502 numeric or value error: character string buffer too small
1 2 3 4 5
--数据库中字段 location varchar2(40) --当 location 存储的字段大于 30 时 插入 l_ship_to_location 会出现此错误 l_ship_to_location varchar2(30); select hcsua.location into l_ship_to_location from hz_cust_site_uses_all hcsua;
# ORA-01858 a non-numeric character was found where a numeric was expected
1 2
--sysdate 是日期类型,'R' 是字符类型,类型不匹配 select nvl(sysdate,'R') from dual;
# PLS-00428: an INTO clause is expected in this SELECT statement
PL/SQL block must has an INTO clause in SELECT statement
1 2 3 4 5 6 7 8
begin execute immediate 'select 1 from dual'; --After sql should has ;, if add will occurs error: ORA-00911: invalid character end;
--PLS-00428: an INTO clause is expected in this SELECT statement begin execute immediate 'begin select 1 from dual; end;'; end;
# ORA-00955: name is already used by an existing object
创建 b 表时报错,因为 b object 已经存在。 查询 user_objects 可以看到 b 是 Java Class.
1
createtable b(id number);
1 2 3 4
select object_name, object_type, created, last_ddl_time, status from user_objects where object_name ='B' orderby object_name;
OBJECT_NAME
OBJECT_TYPE
CREATED
LAST_DDL_TIME
STATUS
B
JAVA CLASS
6/12/2017 9:42:09 AM
8/18/2024 10:00:55 AM
VALID
# ORA-29555: Java source, class or resource is not allowed here
SELECT b 表的时候报错,因为 b 是 Java Class 不是 Table.
1
select*from b;
1 2 3 4 5
select object_name, object_type, created, last_ddl_time, status from user_objects where object_type in ('JAVA CLASS') and object_name ='B' orderby object_name;