问题描述
如何在Oracle SQL Developer中查询数据库名称?我尝试了以下方法,但都失败了:
How do I query the database name in Oracle SQL Developer? I have tried the following and they all fail:
SELECT DB_NAME();
SELECT DATABASE();
为什么这些基本的MySQL查询在SQL Developer中失败?甚至这个失败:
Why do these basic MySQL queries fail in SQL Developer? Even this one fails too:
show tables;
编辑:我可以连接到数据库并运行查询,例如:
I can connect to the database and run queries such as:
select * from table_name_here;
数据库类型为Oracle
,这就是为什么MySQL
查询失败的原因.我认为这与数据库客户端有关,而不与数据库本身有关.我错了.我会把这个问题留给其他人,就像我以前一样迷路.
EDIT 2: The database type is Oracle
, this is why MySQL
queries are failing. I thought it was related to the database client not the database itself. I was wrong. I'll leave the question as is for other as lost as I was.
推荐答案
一旦我意识到我正在运行Oracle数据库而不是MySQL,我就找到了答案
Once I realized I was running an Oracle database, not MySQL, I found the answer
select * from v$database;
或
select ora_database_name from dual;
同时尝试.来源和信誉归功于: http://www.perlmonks.org/?node_id=520376
Try both. Credit and source goes to: http://www.perlmonks.org/?node_id=520376.
这篇关于如何在Oracle SQL Developer中查询数据库名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!