-- Use Oracle to get IP Address and Host Name of local or remote hosts!

SELECT utl_inaddr.get_host_address() AS IP_ADDRESS FROM dual;
IP_ADDRESS                                                                      
--------------------------------------------------------------------------------
192.168.27.58                                                                   
1 row selected
 
 
SELECT utl_inaddr.get_host_address() AS IP_ADDRESS FROM dual;
IP_ADDRESS                                                                      
--------------------------------------------------------------------------------
192.168.27.23                                                                   
1 row selected
 
 
SELECT utl_inaddr.get_host_name('192.168.27.23') AS HOST_NAME FROM dual;
HOST_NAME                                                                       
--------------------------------------------------------------------------------
                                                                
1 row selected
 
 
SELECT utl_inaddr.get_host_name('192.168.27.58') AS HOST_NAME FROM dual;
HOST_NAME                                                                       
--------------------------------------------------------------------------------
                                                               
1 row selected


SELECT utl_inaddr.get_host_address('www.oracle.com') AS IP_ADDRESS FROM dual
IP_ADDRESS                                                                      
--------------------------------------------------------------------------------
141.146.8.66                                                                    
1 row selected
 
 
SELECT utl_inaddr.get_host_name('141.146.8.66') AS HOST_NAME FROM dual
HOST_NAME                                                                       
--------------------------------------------------------------------------------
bigip-otn-portal.oracle.com                                                     
1 row selected