Solved

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

Posted on 2006-11-30
7
2,923 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 500 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 500 total points
ID: 18047752
Ok, now it's line 12.
sys_context('USERENV','IPADDRESS') is wrong

try sys_context('USERENV','IP_ADDRESS')
0
Industry Leaders: 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 500 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

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!

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

685 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