Re: Which DB am I connected to?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Zoury (yanick_lefebvre)
Date: 01/20/05


Date: Thu, 20 Jan 2005 14:11:28 -0500

Hi Andy! :O)

give this query a try :

---
select sys_context('userenv', 'db_name') from dual;
---
-- 
Best Regards
Yanick
"Andy" <Andrzej7@hotmail.com> a écrit dans le message de
news:0c8001c4ff21$c46bf6b0$a401280a@phx.gbl...
> It is not really a VB question, but I will try anyway....
>
> I have some stored procedures in ORACLE that run outside
> my VB 6 app.  When I connect to my DB from VB I know which
> DB I access.
>
> My stored procedures (in PL/SQL) run either against Test
> or Production database.  Sometimes there are small
> differences that need to be implemented depending which DB
> I run my stored proc from, and I don't want to make these
> changes every time I move from test to production - I just
> have to remember to do the changes, and if somebody else
> will have to do it in the future they may not know what to
> change.  And I am not crazy about putting all of the
> changes in comments.....
>
> I can get date by: select sysdate from dual
> I can get user by: select user from dual
>
> Is there any way to know which DB I am accessing in PL/SQL?
>
> like:
> Select WHAT from dual   ?
>
> To get either Test or PROD?
>
> --- Andy

Quantcast