Difference between revisions of "Selecting Database Name"
From TekiWiki
(Created page with "To select the Oracle database name, the most common method is: SELECT name FROM v$database This, however, requires special permissions. The database name is part of the...") |
|||
| Line 12: | Line 12: | ||
For more hints and tips like this, see the eBook: | For more hints and tips like this, see the eBook: | ||
| + | |||
| + | {| class="wikitable" | ||
| + | |- | ||
| + | |[[File:UsingFunctionsInPeopleSoftQuerySmall.jpg|90px|link=http://www.amazon.co.uk/gp/product/B013ZRND0I/ref=as_li_tl?ie=UTF8&camp=1634&creative=6738&creativeASIN=B013ZRND0I&linkCode=as2&tag=springboardso-21]] | ||
| + | |||
| + | | | ||
| + | [http://www.amazon.co.uk/gp/product/B013ZRND0I/ref=as_li_tl?ie=UTF8&camp=1634&creative=6738&creativeASIN=B013ZRND0I&linkCode=as2&tag=springboardso-21 Using Functions in PeopleSoft Query] | ||
| + | |||
| + | [[PeopleSoft Query]] | ||
| + | |||
| + | |} | ||
Revision as of 06:40, 27 May 2016
To select the Oracle database name, the most common method is:
SELECT name FROM v$database
This, however, requires special permissions. The database name is part of the session context and can be selected using the following function:
SELECT sys_context('USERENV', 'DB_NAME') FROM dual
When used as part of a larger query, this does not need to join the v$database pseudo table.
This is particularly useful in packaged solutions like PeopleSoft.
For more hints and tips like this, see the eBook: