PLSQL, SQL*PLUS get current username?

别等时光非礼了梦想. 提交于 2019-12-22 05:04:13

问题


I know that the show user command return: USER is "SCOTT"

But is it possible in a sql query or in a plsql script to only get the username of the current user and store it in a variable?


回答1:


The USER built-in function may be used.

DECLARE
  v VARCHAR2(30);
BEGIN
  v := USER;
END;



回答2:


SYS_CONTEXT( 'USERENV', 'CURRENT_USER' )



回答3:


fnd_profile.value('USERNAME')
fnd_profile.value('USER_ID')
fnd_flobal.user_id

these can be used to get the user details



来源:https://stackoverflow.com/questions/23417522/plsql-sqlplus-get-current-username

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!