Requirement: I have an Oracle APEX Page in which I want to display the Login Username.
Also, I want to use four different approaches to get the Login Username and display it in the various Items of the Oracle APEX page.
Sample screenshot of the above requirement is shown below:
Solution: For the solution of the above requirement follow the steps as shown below:
Step 1: Let us assume we already have an Oracle APEX page created.
Step 2: Create four Items in the Oracle APEX page.
Set the various properties of each of these Items as shown below
Properties for the First Item
- Name as P5_GET_LOGIN_USER_APPROACH1
- Type as Text Field
- Label as Get Login User – Using apex_custom_auth.get_username inside PL/SQL Expression
Also, to set the Default value for the First Item, set the below properties.
- Type as Expression
- Language as PL/SQL
- PL/SQL Expression as apex_custom_auth.get_username
Properties for the Second Item
- Name as P5_GET_LOGIN_USER_APPROACH2
- Type as Text Field
- Label as Get Login Usrr – Using :APP_USER inside PL/SQL Expression
Also, to set the Default value for the Second Item, set the below properties.
- Type as Expression
- Language as PL/SQL
- PL/SQL Expression as :APP_USER
Properties for the Third Item
- Name as P5_GET_LOGIN_USER_APPROACH3
- Type as Text Field
- Label as Get Login User – Using apex_custom_auth.get_username inside SQL Query
Also, to set the Default value for the Third Item, set the below properties.
- Type as SQL Query
- SQL Query as
SELECT apex_custom_auth.get_username FROM DUAL;
Properties for the Fourth Item
- Name as P5_GET_LOGIN_USER_APPROACH4
- Type as Text Field
- Label as Get Login User – Using apex_custom_auth.get_username inside PL/SQL Function Body
Also, to set the Default value for the Fourth Item, set the below properties.
- Type as Function Body
- Language as PL/SQL
- PL/SQL Function Body as
DECLARE
vLoginUser VARCHAR2(30);
BEGIN
SELECT apex_custom_auth.get_username INTO vLoginUser FROM DUAL;
RETURN vLoginUser;
END;
Step 3: Save and run the application. Thus, the ran application is shown below:
Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
2,214 total views, 7 views today
Concrete