Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ORA-06512: at "SYS.OWA_UTIL", line 324

Posted on 2006-11-30
7
Medium Priority
?
3,074 Views
Last Modified: 2008-01-09
Hi

I am trying something different. Trying to capture Ip address information in a trigger using owa_util.get_cgi_env('REMOTE_ADDR'). the problem is some time I will be inserting values from sqlplus.
when I try to insert values from sqlplus I am getting below error. I am stucked with this error can you please help me how to handle this error and how to capture Ipaddress in this situation.

SQL> insert into loc values (12222, 2, 'jkhs', 734, 'Y', 0);
insert into loc values (12222, 2, 'jkhs', 734, 'Y', 0)
            *
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 324
ORA-06512: at "TRIGGER_LOC", line 16
ORA-04088: error during execution of trigger 'TRIGGER_LOC'


11      if       owa_util.get_cgi_env('REMOTE_ADDR') is null then
12            v_ipaddress := sys_context('USERENV','IPADDRESS');
13      else
14            v_ipaddress := owa_util.get_cgi_env('REMOTE_ADDR');      
15      end if;
16      dbms_output.put_line(owa_util.get_cgi_env('REMOTE_ADDR'));
0
Comment
Question by:basirana
  • 3
  • 3
7 Comments
 
LVL 2

Assisted Solution

by:sunnypoint
sunnypoint earned 1500 total points
ID: 18047062
I would set serveroutput on in sqlplus, and debug like this:

11     if      owa_util.get_cgi_env('REMOTE_ADDR') is null then
12          v_ipaddress := sys_context('USERENV','IPADDRESS');
             dbms_output.put_line(sys_context('USERENV','IPADDRESS')); -- added
13     else
14          v_ipaddress := owa_util.get_cgi_env('REMOTE_ADDR');  
            dbms_output.put_line(owa_util.get_cgi_env('REMOTE_ADDR'));  -- added
15     end if;
16     dbms_output.put_line(v_ipaddress );      -- changed

See what will happend.
0
 

Author Comment

by:basirana
ID: 18047575
Still I am geting same error
I have tried to debug but it is not working

SQL> insert into tb_locations values (12222, 2, 'jkhs', 734, 'Y', 0);

insert into tb_locations values (12222, 2, 'jkhs', 734, 'Y', 0)
            *
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 324
ORA-06512: at "INTRA.TRG_TB_LOCATIONS", line 12
ORA-04088: error during execution of trigger 'INTRA.TRG_TB_LOCATIONS'

if     owa_util.get_cgi_env('REMOTE_ADDR') is null then
       v_ipaddress := sys_context('USERENV','IP_ADDRESS');
     dbms_output.put_line(sys_context('USERENV','IPADDRESS'));
else
       dbms_output.put_line(owa_util.get_cgi_env('REMOTE_ADDR'));
         v_ipaddress := owa_util.get_cgi_env('REMOTE_ADDR');  
end if;
dbms_output.put_line(v_ipaddress );
0
 
LVL 2

Accepted Solution

by:
sunnypoint earned 1500 total points
ID: 18047752
Ok, now it's line 12.
sys_context('USERENV','IPADDRESS') is wrong

try sys_context('USERENV','IP_ADDRESS')
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:basirana
ID: 18047760
I did that still I am getting same error message. not sure whats going on.
0
 
LVL 2

Assisted Solution

by:sunnypoint
sunnypoint earned 1500 total points
ID: 18047847
Did you recompile you trigger after fixing the error?
How did you declare v_ipaddress ? It should be varchar2, not number
Also, turn on serveroutput in sqlplus to see what the output is.
0
 

Author Comment

by:basirana
ID: 18049241
v_ipadress varchar2(200)
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 18066644
please put your full trigger code here and then paste the all errors here. If both are there, then you will get your answer quickly.

also any errors during trigger compilation ?

Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question