0

I want to reference app_user in query (where username=(:APP_USER)) Now my query returns null values, I guess it's happening because my username col is varchar2. How to reference app_user in this situation?

3 Answers 3

2

you can use below:

where username=v('APP_USER')

Edit1: for performance constraints, it is always recommended that you do it like this:

where username=(select v('APP_USER') from dual)
0
0

:APP_USER value depends upon the authentication model set in your application. If application is running using database authentication then the value of the user is the same as the database pseudo column USER. If the application uses an authentication scheme that requires the user to authenticate, the value of APP_USER is set by the authentication scheme, usually to the user name used during authentication.

Reference : Oracle documentation

5
  • I'm using custom authentication scheme. I tried :APP_USER and &APP_USER. Both don't work. Please help Commented Jan 8, 2017 at 21:19
  • I tried :APP_USER in another table where the username is a number and it worked. But in this table it doesn't Commented Jan 8, 2017 at 21:20
  • @user2950439 have look at this answer this should helphttp://stackoverflow.com/questions/8148247/setting-the-app-user-as-a-value-to-be-passed-to-target-page-in-apex Commented Jan 8, 2017 at 21:24
  • still returns null Commented Jan 8, 2017 at 21:32
  • you can use where username=v('APP_USER') Commented Feb 12, 2019 at 16:24
0

apex make username uppercase try (where UPPER(username)=(:APP_USER))

Not the answer you're looking for? Browse other questions tagged or ask your own question.