Sun. Oct 24th, 2021

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

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

One thought on “Different ways to get Login Username in Oracle APEX”

Leave a Reply

Your email address will not be published. Required fields are marked *

satta king chart