Solved

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

Posted on 2006-11-30
7
2,929 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.

710 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