View Single Post
Old May 30th, 2006, 11:34 AM   #1
Gumby
Newbie
 
Join Date: Mar 2006
Location: Andover, MA / Rochester, NY / Nanticoke, PA
Posts: 16
Rep Power: 0 Gumby is on a distinguished road
Send a message via AIM to Gumby
PL/SQL - get DB name

Hey,

I want to get the database name in a PL/SQL trigger.

At the SQLPlus prompt, these are some examples I've tried:

fsdevl75@fsdev> select sys_context('userenv', 'db_name') from dual;

SYS_CONTEXT('USERENV','DB_NAME
---------------------------------------------------------------------------
13

fsdevl75@fsdev> select '&_CONNECT_IDENTIFIER' from dual;
old   1: select '&_CONNECT_IDENTIFIER' from dual
new   1: select 'fsdev' from dual

'FSDEV'
--------------------------------
fsdev

fsdevl75@fsdev> desc v$database;
ERROR:
ORA-04043: object "SYS"."V_$DATABASE" does not exist

I want what _CONNECT_IDENTIFIER returns (fsdev in this case), but I can't figure out any way to do this in a trigger. Can anybody help with this?
Gumby is offline   Reply With Quote