In Oracle there is UTL_INADDR package that is an API to access host name and ip address of server.
Usage
select UTL_INADDR.get_host_name('host_name') from dual;
select UTL_INADDR.get_address_name('ip_address') from dual;
If host_name or ip_address is null, this function returns local host hostname or ip.
If hostname or IP can't be resolved, error ORA-29257:host [ip or name] unknown is returned.
Usage
select UTL_INADDR.get_host_name('host_name') from dual;
select UTL_INADDR.get_address_name('ip_address') from dual;
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; /
If host_name or ip_address is null, this function returns local host hostname or ip.
If hostname or IP can't be resolved, error ORA-29257:host [ip or name] unknown is returned.
No comments:
Post a Comment