Tuesday 23 April 2013

Retrieve IP Address and Host Name using PL/SQL


Using the UTL_INADDR package, a PL/SQL subprogram can determine the host name of the local system or the IP address of a given host name.

E.g. Retrieve the local host name and IP address.

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
    DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_ADDRESS('apps.ora.com'));
    DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_NAME('192.168.4.157'));
END;

0 comments:

Post a Comment