Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Utl_inaddr

45 views
Skip to first unread message

AMIT

unread,
Mar 12, 2004, 2:34:43 AM3/12/04
to
Hi,

After running the following Pl/SQl block I am getting the following error.
Could some one suggest about it what’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

Regards

Kumar


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;
/

Daniel Morgan

unread,
Mar 12, 2004, 2:47:06 AM3/12/04
to
AMIT wrote:

> Hi,
>
> After running the following Pl/SQl block I am getting the following error.
> Could some one suggest about it what’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
>
>
>
> Regards
>
> Kumar

Count your parenthesis.

--
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damo...@x.washington.edu
(replace 'x' with a 'u' to reply)

AMIT

unread,
Mar 12, 2004, 11:23:06 AM3/12/04
to
Hi,Daniel Morgan

I think the parenthesis is correct.


dbms_output.put_line('Client Name:
'||utl_inaddr.get_host_name(sys_context('USERENV','IP_ADDRESS')));

Could you plz check it?

Thanks

Amit


<damo...@x.washington.edu> wrote in message news:<1079077597.344257@yasure>...

Daniel Morgan

unread,
Mar 12, 2004, 12:19:19 PM3/12/04
to
AMIT wrote:

I have working demos of UTL_INADDR at:
http://www.psoug.org/reference/library.html

Andy Hassall

unread,
Mar 13, 2004, 2:03:27 PM3/13/04
to
On 11 Mar 2004 23:34:43 -0800, kuma...@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 <an...@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>

AMIT

unread,
Mar 14, 2004, 12:15:47 AM3/14/04
to
Hi,

I also like to say I am using version 8.1.7.0.
Is that the reason, that the error comes during running this?

Thanks

Amit

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);


Andy Hassall <an...@andyh.co.uk> wrote in message news:<vim650d70n4u3ms23...@4ax.com>...

AMIT

unread,
Mar 14, 2004, 3:51:30 AM3/14/04
to
Hi Andy,

I am using version 8.1.7.0.

I still got the same error.

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

Regards

Kumar


Code:

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;

Andy Hassall <an...@andyh.co.uk> wrote in message news:<vim650d70n4u3ms23...@4ax.com>...

Andy Hassall

unread,
Mar 14, 2004, 6:37:33 AM3/14/04
to
On 14 Mar 2004 00:51:30 -0800, kuma...@yahoo.co.uk (AMIT) wrote:

>I am using version 8.1.7.0.
>I still got the same error.
>
>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

I don't have access to an 8i instance right now, just 9i and 10g where your
code works for me. Try just outputting the value of
sys_context('USERENV','IP_ADDRESS') on its own. And try:

select utl_inaddr.get_host_name('<put your IP address here>') from dual

... and see what it does. In other words, start cutting it down into smaller
chunks to try and isolate where the problem is.

Anurag Varma

unread,
Mar 14, 2004, 8:55:25 PM3/14/04
to

"AMIT" <kuma...@yahoo.co.uk> wrote in message
news:6f94b59f.04031...@posting.google.com...

> Hi Andy,
>
> I am using version 8.1.7.0.
> I still got the same error.
>
> 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
>
>
>
> Regards
>
> Kumar
>

Just do a desc on utl_inaddr and you would know your answer.
In 8i it does not take any parameters.

or just read the utlinad.sql in rdbms/admin ....

Anurag


0 new messages