Solved

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

Posted on 2006-11-30
7
2,966 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Suggested Courses

627 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