Search This Blog

Friday, July 24, 2009

Retrieve IP Address and Host Name usingPL/SQL

On request from one of our reader.
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.


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
DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_ADDRESS('www.oracle.com'));
DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_NAME('141.146.9.91'));
END;


Reference: www.oracle.com

5 Comments:

Ram said...

hi sureh,
thanks pa... i will try this code, i think i will solve my problem....

thanks
Ramesh
Bangalore......

Unknown said...

Dear Suresh,

Thanks..
Its very useful..

Regards,
venkat

Ram said...

hi suresh

this is Ramesh,Bangalore.
i am now using "Reports 6i",
in my report i want to display "images" with respect to records in Student details, the images are stored in one folder,for every record image path will be stored and displayed in "report"... if all images found it will print the output, "If any one IMAGE NOT FOUND IN THAT FOLDER" THEN NO RECORDS WILL BE PRINTED..... WHAT THE SOLUTION FOR THIS REPORT....
THANKS
RAMESH....

Suresh Vaishya said...

Hi Ram,
For one of the client I have seen a report where the image was stored in a database. The column was then referred to one of the field in reports and file type is changed to image. I will try to post something related to this in blog. Please check back the blog in few days.
Thanks,
suresh

Suresh Vaishya said...

Ram, I have published a post to discuss the steps to create report using images.

Copyright (c) All rights reserved. Presented by Suresh Vaishya