Home » SQL & PL/SQL » SQL & PL/SQL » DB2 to Oracle migration
DB2 to Oracle migration [message #204227] Sun, 19 November 2006 06:32 Go to next message
usa777
Messages: 4
Registered: November 2006
Junior Member
I use 'CURRENT SERVER' special register to return the name of the database I am connected to in DB2. Is the function corresponding to 'CURRENT SERVER' in Oracle?
Re: DB2 to Oracle migration [message #204228 is a reply to message #204227] Sun, 19 November 2006 06:41 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

hi
you want to current database name in Oracle ...while connected to database.
sql>show parameter db_name
sql>select name from v$database;
sql>select * from global_name;


you can choose any one option in above three options for required result.

hope this helps
Taj.

edit db_name to name.

[Updated on: Sun, 19 November 2006 22:07]

Report message to a moderator

Re: DB2 to Oracle migration [message #204229 is a reply to message #204228] Sun, 19 November 2006 08:07 Go to previous messageGo to next message
usa777
Messages: 4
Registered: November 2006
Junior Member
I appreciate your advice.
I understand the I solve the problem by getting db_name, but "select db_name from v$database;" doesn't work.
I don't know what's wrong.
Re: DB2 to Oracle migration [message #204230 is a reply to message #204229] Sun, 19 November 2006 08:38 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

hi

What error you get ?
plz. post here.

Re: DB2 to Oracle migration [message #204235 is a reply to message #204230] Sun, 19 November 2006 11:30 Go to previous messageGo to next message
usa777
Messages: 4
Registered: November 2006
Junior Member

The following error happened.
SQL> select db_name from v$database;
select db_name from v$database
*
ORA-00904: "DB_NAME": invalid identifier
Re: DB2 to Oracle migration [message #204237 is a reply to message #204235] Sun, 19 November 2006 11:44 Go to previous messageGo to next message
Littlefoot
Messages: 20895
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
In that case, use

SELECT * FROM v$database;

You'll get all information stored in that view (and among them IS a database name, but column name won't DB_NAME but NAME).
Re: DB2 to Oracle migration [message #204414 is a reply to message #204237] Mon, 20 November 2006 09:56 Go to previous message
usa777
Messages: 4
Registered: November 2006
Junior Member
I get the database name as follows:

SELECT name FROM v$database;

Thank you.
Previous Topic: Crypt and Decrypt Fileds
Next Topic: Access different schema from another schema.
Goto Forum:
  


Current Time: Tue Dec 06 00:01:00 CST 2016

Total time taken to generate the page: 0.08549 seconds