Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Utl_inaddr

Re: Utl_inaddr

From: Andy Hassall <andy_at_andyh.co.uk>
Date: Sat, 13 Mar 2004 19:03:27 +0000
Message-ID: <vim650d70n4u3ms233rd4vtmv73icgdnsa@4ax.com>


On 11 Mar 2004 23:34:43 -0800, kumar_929_at_yahoo.co.uk (AMIT) wrote:

>After running the following Pl/SQl block I am getting the following error.
>Could some one suggest about it what&#8217;s wrong in it?
>
>utl_inaddr.get_host_name(sys_context('USERENV','IP_ADDRESS')));
>*
>ERROR at line 10:
>ORA-06550: line 10, column 2:
>PLS-00306: wrong number or types of arguments in call to 'GET_HOST_NAME'
>ORA-06550: line 9, column 2:
>PL/SQL: Statement ignored
>
>declare
>v_gname varchar2(256);
>begin
> select global_name into v_gname from global_name;
> dbms_output.put_line('User: '||user);
> dbms_output.put_line('Database: '||v_gname);
> dbms_output.put_line('Client IP: '||
> sys_context('USERENV','IP_ADDRESS'));
> dbms_output.put_line('Client Name: '||
> utl_inaddr.get_host_name(sys_context('USERENV','IP_ADDRESS')));
> dbms_output.put_line('DB Server IP: '||utl_inaddr.get_host_address);
> dbms_output.put_line('DB Server Name: '||utl_inaddr.get_host_name);
>end;
>/

 Works fine for me, code unchanged from your post:

Connected to Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 Connected as test

SQL> set serveroutput on
SQL> 
SQL> declare

  2 v_gname varchar2(256);
  3 begin
  4 select global_name into v_gname from global_name;
  5   dbms_output.put_line('User: '||user);
  6   dbms_output.put_line('Database: '||v_gname);
  7   dbms_output.put_line('Client IP: '||
  8 sys_context('USERENV','IP_ADDRESS'));   9 dbms_output.put_line('Client Name: '||  10 utl_inaddr.get_host_name(sys_context('USERENV','IP_ADDRESS')));  11 dbms_output.put_line('DB Server IP: '||utl_inaddr.get_host_address);  12 dbms_output.put_line('DB Server Name: '||utl_inaddr.get_host_name);  13 end;
 14 /
User: TEST
Database: DEV101
Client IP: 192.168.1.14
Client Name: excession.localhost
DB Server IP: 127.0.0.1
DB Server Name: testbox.localhost

PL/SQL procedure successfully completed

 Your Oracle version is?

 Try:

SQL> desc utl_inaddr.get_host_name;
Parameter Type Mode Default?
--------- -------- ---- --------

(RESULT)  VARCHAR2               
IP        VARCHAR2 IN   Y        

 Does your version, for some reason, have a differing argument list? Perhaps it changed in some version.

-- 
Andy Hassall <andy_at_andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Received on Sat Mar 13 2004 - 13:03:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US