有时候需要知道oracle的error code的具体含义, 但总是找不全
不过可以通过以下方式直接从oracle数据库本身获得:
create type t_oracle_error is object (
error_num varchar2(9),
error_desc varchar2(1024)
);
create type t_oracle_error_tab is table of t_oracle_error;
create or replace function OracleErrors return t_oracle_error_tab pipelined is
l_error t_oracle_error := t_oracle_error(null,null);
begin
for errNo in reverse -32799..0 loop
l_error.error_num := errNo;
l_error.error_desc := sqlerrm(errNo);
if l_error.error_desc not like '%Message % not found;%' and l_error.error_desc != 'ORA'||to_char(errNo,'FM09999')||': ' then
pipe row(l_error);
end if;
end loop;
return;
end OracleErrors;
select * from table(oracleerrors);
不过可以通过以下方式直接从oracle数据库本身获得:
create type t_oracle_error is object (
error_num varchar2(9),
error_desc varchar2(1024)
);
create type t_oracle_error_tab is table of t_oracle_error;
create or replace function OracleErrors return t_oracle_error_tab pipelined is
l_error t_oracle_error := t_oracle_error(null,null);
begin
for errNo in reverse -32799..0 loop
l_error.error_num := errNo;
l_error.error_desc := sqlerrm(errNo);
if l_error.error_desc not like '%Message % not found;%' and l_error.error_desc != 'ORA'||to_char(errNo,'FM09999')||': ' then
pipe row(l_error);
end if;
end loop;
return;
end OracleErrors;
select * from table(oracleerrors);