Home » SQL & PL/SQL » SQL & PL/SQL » Database Link Problem (Oracle Sql Plsql)
Database Link Problem [message #585203] Wed, 22 May 2013 23:57 Go to next message
swapnilpimple
Messages: 33
Registered: July 2010
Location: Mumbai
Member
Dear All,

I have created a function for knowing the status of link which connect me with remote database.
function is as follows

------------------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION get_status_db_link (p_db_link_in VARCHAR2)
RETURN NUMBER AS
rows NUMBER;
v_code NUMBER;
v_errm VARCHAR2(64);

BEGIN
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM dual@' || p_db_link_in INTO rows;
RETURN rows;
EXCEPTION
WHEN OTHERS THEN
v_code := SQLCODE;
v_errm := SUBSTR(SQLERRM, 1 , 64);
DBMS_OUTPUT.PUT_LINE('Error code ' || v_code || ': ' || v_errm);
return 0;

END;
----------------------------------------------------------------------------------------

Now functin should returns 1 when link is up and it should return 0 when link down
but sometime when link is down it continues showing executing it hang my pc.

Please help me regarding this

Swapnil Pimple
Re: Database Link Problem [message #585205 is a reply to message #585203] Thu, 23 May 2013 00:04 Go to previous message
Michel Cadot
Messages: 58607
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is expected, you cannot avoid this case.

Regards
Michel
Previous Topic: Retrieve view definiton
Next Topic: ORA-06550: (2 Merged)
Goto Forum:
  


Current Time: Tue Jul 29 06:21:49 CDT 2014

Total time taken to generate the page: 0.08726 seconds