I want a global variable (application item) whose value will be set at the start when a user logs in to the application. The value will be retrieved from database using a sql query. I do not know the exact syntax to set the value of application item in application process. Also i want to know in which type of application process should i use to set the value of application item when a user starts a session. The value of application item varies from user to user.
I am using apex 4.2
You can use the application item as bind-variable with its name. ie. your application item is named G_MY_APPLICATION_ITEM, then you can access/set it using :G_MY_APPLICATION_ITEM.
-- assign like a variable
:G_MY_APPLICATION_ITEM := 'LARRY';
-- use in a SQL statement
WHERE USERNAME = :APP_USER