View Single Post
Old May 30th, 2006, 3:00 PM   #2
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Quote:
Originally Posted by Gumby
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?
Hey,

I would probably see if i could do a SELECT INTO into a var, then return the var (or do what ever you want with the results).

here's a example on SELECT INTO: http://www.postgresql.org/docs/8.1/i...QL-SELECT-INTO
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote