You Asked
Hi Tom,
I have created a table to transfer the Oracle Help like
ORA, DBA, FRM errors to this table now I have all these
errors in oracle help now how do i transfer these into text and
transfer to the table I have created. At Present I have created
a form and saving these records but it is very hard to type all
the 20000 records one by one into the form and save it to the
table. If U can tell me How do I transfer these type of Error
messages into the table it will be helpful.
The ORA errors are in the Form like Oracle help file ie. it is
the oracle errors help file so i would like to export only
the ora errors to a table that i have created in my database.
Regards
ash.
and Tom said...
Here is what I would do:
o load the msg file into a table, for example to get the US version of the ORA-XXXXX messages, i would load $ORACLE_HOME/rdbms/mesg/oraus.msg into a table virtually "as is" (just the relevant lines)
o I would use a stored procedure to massage the data and make it "relational".
For example, I would have 2 tables:
create TABLE temp_table
(
seqno number primary key ,
text varchar2(4000)
)
/
create table msg_table
( err_code number,
err_type varchar2(3),
err_msg varchar2(255),
err_text varchar2(4000),
primary key(err_code,err_type)
)
/
I would load the TEMP_TABLE using:
LOAD DATA
REPLACE
INTO TABLE temp_table
when (1:2) = '//'
(
text position(1:4096) ,
seqno recnum
)
INTO TABLE temp_table
when (1:1) <> '/'
(
text position(1:4096) ,
seqno recnum
)
with a sqlldr command line like:
$ sqlldr userid=u/p control=load.ctl data=$ORACLE_HOME/rdbms/mesg/oraus.msg
(thats on one line of course)...
And then using a stored procedure like:
create or replace procedure move_data( p_err_type in varchar2 )
as
l_last_err_code number;
l_last_err_msg varchar2(255);
l_last_err_text varchar2(4000);
l_n number;
l_sep char(1);
begin
for x in ( select * from temp_table order by seqno )
loop
if ( x.text not like '//%' ) then
begin
if ( l_last_err_code is NOT NULL ) then
insert into msg_table
( err_code, err_type, err_msg, err_text )
values
( l_last_err_code, p_err_type, l_last_err_msg,
l_last_err_text );
end if;
l_n := instr( x.text, ',' );
l_last_err_code := substr( x.text, 1, l_n-1 );
x.text := substr( x.text, l_n+1 );
l_n := instr( x.text, ',' );
l_last_err_msg := substr( x.text, l_n+1 );
l_last_err_text := NULL;
l_sep := NULL;
exception
when others then
dbms_output.put_line( x.text );
raise;
end;
else
l_last_err_text := l_last_err_text || l_sep ||
x.text;
l_sep := chr(10);
end if;
end loop;
if ( l_last_err_code is NOT NULL ) then
insert into msg_table
( err_code, err_type, err_msg, err_text )
values
( l_last_err_code, p_err_type, l_last_err_msg,
l_last_err_text );
end if;
end;
/
I can format the data correctly by executing:
SQL> exec move_data( 'ORA' );
Now, I can:
ops$tkyte@8i> select * from
2 msg_table where err_code = 54 and err_type= 'ORA';
ERR_CODE ERR
---------- ---
ERR_MSG
----------------------------------------------------------------------------------------------------
ERR_TEXT
----------------------------------------------------------------------------------------------------
54 ORA
"resource busy and acquire with NOWAIT specified"
// *Cause: Resource interested is busy.
// *Action: Retry if necessary.
which is the same answer I get with
ops$tkyte@8i> !oerr ora 54
00054, 00000, "resource busy and acquire with NOWAIT specified"
// *Cause: Resource interested is busy.
// *Action: Retry if necessary.
Rating
(4 ratings)
Is this answer out of date? If it is, please let us know via a Comment