-- Author: Ahbaid Gaffoor - OCPdba.Net -- File: whoami.sql -- -- Purpose: Creates a public function whoami that allows a user to see the database and user he/she is connected to. -- the database and user he/she is connected to. -- PROMPT Enter SYS Password and TNS Connect String.... CONNECT SYS AS SYSDBA -- -- Create the WHOAMI() function -- CREATE OR REPLACE FUNCTION WHOAMI RETURN VARCHAR2 AS DBN VARCHAR2(100); BEGIN SELECT NAME||': '||USER INTO DBN FROM V$DATABASE; RETURN DBN; END; / -- -- Give Permissions to Public -- grant execute on whoami to public; create public synonym whoami for whoami;