Skip Headers
Oracle® Database PL/SQL Packages and Types Reference
11g Release 2 (11.2)

Part Number E10577-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

224 UTL_INADDR

The UTL_INADDR package provides a PL/SQL procedures to support internet addressing. It provides an API to retrieve host names and IP addresses of local and remote hosts.

This chapter contains the following topics:


Using UTL_INADDR


Exceptions

Table 224-1 Exception - Internet Address Package

Number Exception Description

ORA-24247

NETWORK_ACCESS_DENIED

Access to network is denied.

ORA-29257

UNKNOWN_HOST

The host is unknown.



Examples

Retrieve the local host name and IP address.

SET serveroutput on
BEGIN
  DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_NAME);  -- get local host name
  DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_ADDRESS);  -- get local IP addr
END;
/

Summary of UTL_INADDR Subprograms

Table 224-2 UTL_INADDR Package Subprograms

Subprogram Description

GET_HOST_ADDRESS Function

Retrieves the IP address of the local or remote host given its name

GET_HOST_NAME Function

Retrieves the name of the local or remote host given its IP address



GET_HOST_ADDRESS Function

This function retrieves the IP address of the specified host.

Syntax

UTL_INADDR.GET_HOST_ADDRESS (
   host  IN VARCHAR2 DEFAULT NULL) 
RETURN host_address VARCHAR2; 

Parameters

Table 224-3 GET_HOST_ADDRESS Function Parameters

Parameter Description

host

The name of the host to retrieve the IP address.


Return Values

Table 224-4 GET_HOST_ADDRESS Function Return Values

Parameter Description

host_address

The IP address of the specified host, or that of the local host if host is NULL.


Exceptions

UNKNOWN_HOST: The specified IP address is unknown.


GET_HOST_NAME Function

This function retrieves the name of the local or remote host given its IP address.

Syntax

UTL_INADDR.GET_HOST_NAME (
   ip  IN VARCHAR2 DEFAULT NULL)
RETURN host_name VARCHAR2;

Parameters

Table 224-5 GET_HOST_NAME Function Parameters

Parameter Description

ip

The IP address of the host used to determine its host name. If ip is not NULL, the official name of the host with its domain name is returned. If this is NULL, the name of the local host is returned and the name does not contain the domain to which the local host belongs.


Return Values

Table 224-6 GET_HOST_NAME Function Return Values

Parameter Description

host_name

The name of the local or remote host of the specified IP address.


Exceptions

UNKNOWN_HOST: The specified IP address is unknown