Skip to main content

How to display image without page item reference in Oracle APEX

In this section, we'll learn how to display images in our Oracle APEX application without relying on a page item. This method is perfect for situations where we need to show an image directly from a database table column, a file, or a URL without first loading it into a specific page item. We'll cover how to achieve this using a dynamic action and a PL/SQL procedure, making our application more efficient and flexible. By the end of this tutorial, we'll be able to display images dynamically, improving the user experience and reducing page load times. This technique is useful for reports, dashboards, and custom user interfaces where a static page item isn't the best solution. You can vind a visual  solution  from here. STEP 1: Create a blank page. STEP 2: Create a region and set it properties like-          Name:                    Emp          Type:      ...

How to login your Oracle Apex application from cookies

Managing user authentication efficiently is one of the key aspects of building secure and user-friendly web applications. In Oracle APEX, we usually rely on session-based authentication methods such as database accounts, Single Sign-On (SSO), or custom authentication schemes. However, in some cases, you might want to provide a smoother login experience by leveraging browser cookies. This approach allows your application to remember returning users and automatically log them in without repeatedly prompting for credentials. In this post, we’ll explore how to implement cookie-based login in Oracle APEX step by step. For better understanding you can follow login from cookies. 

Step- 1: Open your Login Page in Developer mode.

 Step- 2: Create a new item and set the below properties-

            Name: P9999_REMEMBER

            Type: Checkbox Group

            Label: Remember Me

            Number of Columns: 1

            List of Values > Type: Share Component

                                        List of Values: REMEMBER_LOGIN_USERNAME

 Step- 3: Navigate to process tab from navigation pane.

            Create a new process under processing section or modify the existing process named "Set         Username Cookie"

            Set the below properties of this process:

            Name: <Your Process Name Here>

            Type: Execute Code

            Source : Local Database

            Language: PL/SQL

            Write the below PL/SQL code in the language properties-

            IF :P9999_REMEMBER = 'Y' THEN

                    BEGIN

                            owa_util.mime_header('text/html', FALSE);

                            OWA_COOKIE.SEND(

                                       NAME => 'APEX_APPS_102',

                                       VALUE => :P9999_USERNAME||':'||apex_util.get_hash(apex_t_varchar2(:P9999_USERNAME, :P9999_PASSWORD),NULL), -- Could also set this to null

                                       EXPIRES => SYSDATE + 100, -- use null if set cookie for a session

                                       PATH => '/',

                                       DOMAIN => NULL, 

                                       SECURE => NULL);

                        END;

            END IF;


 Step- 4: Navigate to rendering tab from navigation pane.

            Navigate to- Pre-Rendering > Process

            Create a new process or you can modify the existing process named "Get Username Cookie".

            Set the below properties of this process:

            Name: <Your Process Name Here>

            Type: Execute Code

            Source : Local Database

            Language: PL/SQL

            Write the below PL/SQL code in the language properties-

            DECLARE

                  c OWA_COOKIE.cookie;

                 a wwv_flow_global.vc_arr2;  

                  l_pass    varchar2(2000);

            BEGIN

                  c := OWA_COOKIE.get('YOUR COOKIE NAME HERE');

                  a := htmldb_util.string_to_table(c.vals(1)); --Retrived value(user name and password) from cookie.

                  :P9999_USERNAME := a(1); -- Segregate username from value and.  

                  :P9999_PASSWORD := a(2);   -- Segregate password from value.  

          BEGIN

                    -- Cross check the cookies user comparing with the existing application user from database.

                  select pass_word

                  into l_pass

                  from app_user

                  where user_id = :P9999_USERNAME;

          EXCEPTION

                  WHEN NO_DATA_FOUND THEN

                    NULL;

          END;

          IF l_pass = :P9999_PASSWORD  THEN

                   -- If matched then call the login function and redirect it to home page

                  apex_authentication.login(

                            p_username => :P9999_USERNAME,

                            p_password => :P9999_PASSWORD );

          else

              null;

          END IF;

        EXCEPTION

                WHEN NO_DATA_FOUND THEN

                NULL;

        END;

Comments

Popular posts from this blog

How to preview & download files from database or local directory in Oracle APEX

 It is common for Oracle APEX developers to need to handle files. This blog post will show you how to preview and download files stored in a database or a local directory. The most common approach in Oracle APEX is to store files directly in the database, typically within a BLOB (Binary Large Object) column. The primary reason is that this method simplifies data management and backup. Sometimes, you may need to handle files stored directly on the server's file system rather than in the database. This is common for large files or when files are managed by other systems. We will cover the basic steps and code snippets required for each method. Before approaching this tutorial, you must need to cover ( preview image in large scale  and  save file into database/local directory ) these two tutorial. Step 1: Create a blank page and then create 3 regions. Set these three regions properties as like below- Region-1:     Name:           ...

How to integrate gmail and send email from Oracle APEX

Manually managing communications with vendors and customers in today's enterprise environment is a time-consuming and often inefficient process. Juggling emails, follow-ups, and notifications can quickly become overwhelming, leading to missed opportunities and delays. To streamline this critical aspect of business, it's essential to modernize your communication system. By integrating email directly into your business software, you can automate these interactions, ensuring timely and consistent communication without the manual effort. I have try to demonstrate step by step how to integrate gamil account with application in Oracle APEX. For better understanding, you can follow the email configuration system. Step 1: Create Access Control List (ACL). Connect your sys user and execute the below command- DECLARE     l_acl_path     VARCHAR2(3000); BEGIN     SELECT acl     INTO l_acl_path     FROM dba_network_acls     WHERE host = '*'...

How to send SMS from Oracle APEX

 In today’s digitalized business solution world, SMS notifications are one of the fastest ways to reach users. Whether it’s for OTP (One-Time Password), reminders, or alerts, integrating SMS with your Oracle APEX application can add huge value. In this guide, we’ll walk through different ways to send SMS from Oracle APEX . For better understand follow this  Tutorial in Youtube. Why Send SMS from Oracle APEX? Oracle APEX already provides built-in features for sending emails, but sometimes email isn’t enough. SMS can be useful for: OTP & Two-factor Authentication Order Confirmations Text Notifications Promotional Messages Process to Send SMS in Oracle APEX 1. Register with Third Party SMS Gateway Most SMS providers (like Twilio, Nexmo, or local telecom gateways) expose a REST API to send SMS. Oracle APEX supports REST integrations, so you can call these APIs directly. Steps: Choose an SMS provider (e.g., Twilio, Nexmo, Clickatell, or your local...