Solved

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

Posted on 2006-11-30
7
2,853 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now