[英]How can I get the name of a logged in user from a database?
More specifically an Oracle database.更具体地说,是 Oracle 数据库。 Say I am logged in as foo
.假设我以foo
身份登录。 How do I get the name?我如何得到这个名字?
Also does this pose a security risk if the name is exposed to someone?如果名称暴露给某人,这是否也会带来安全风险?
SELECT user, uid FROM dual
From http://sqlzoo.net/howto/source/z.dir/tip492545/oracle来自http://sqlzoo.net/howto/source/z.dir/tip492545/oracle
(First google hit on "oracle whoami") (第一个谷歌点击“oracle whoami”)
in sqlplus you can just type在 sqlplus 你可以输入
show user
Another option:另外的选择:
SELECT * from user_users
I'd personally probably use the USER
function (as stated by Stefan in one of the other answers) by using select user from dual
or something similar but it's good to have other options.我个人可能会通过使用select user from dual
使用USER
function (如 Stefan 在其他答案之一中所述),但最好有其他选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.