[Hint] -Function Tests connection

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Fri, 01 Jul 2005 11:56 am

This function tests whether the connection is ok.

Code: Select all
FUNCTION NotLoggedOn RETURN boolean IS
  Dummy varchar2(1);
BEGIN
  select 'x' into dummy from dual;
  return FALSE;
EXCEPTION
  when OTHERS then
    if SQLCODE in (-1012, -- Not logged on
                  -28,   -- Your session has been killed
                  -3114  -- Not connected to ORACLE
                  ) then
      return TRUE;
    end if;
    raise;
END;
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered


Return to PL/SQL

Who is online

Users browsing this forum: No registered users and 14 guests