Posts

Showing posts from June, 2021

Oracle Quick Tips #1

Image
LIKE &  REGEXP_LIKE LIKE:- The Oracle LIKE condition allows wildcards to be used in the WHERE clause of a  SELECT,INSERT,UPDATE or DELETE statement. REGEXP_LIKE:- The Oracle REGEXP_LIKE condition allows you to perform regular expression matching in the WHERE clause of a SELECT, INSERT, UPDATE, or DELETE statement. From the above statements we can conclude that there is no much difference in the functionality of a LIKE and REGEXP_LIKE conditions. But when we use these operators to find/match multiple values/words the repetition can be avoided by using REGEXP_LIKE. LIKE Example: WHERE (COLUMN LIKE '%value1%' OR COLUMN LIKE '%value2% OR....) REGEXP_LIKE Example: Much Easier The pipe symbol '|' inside the regular expression acts as the OR operator and the parenthesis () form the subexpression that is needed for that OR. WHERE REGEXP_LIKE(COLUMN,'(value1|value2|value3...)') OR &  ANY OR:- The Oracle OR  operator is a logical operator that comb

Close Modal Dialog When Clicked Outside in Oracle APEX

Image
Modal Dialog  page in Oracle APEX by default can be closed my clicking the (x) icon/button on the top right corner of the modal page. In this post I will be explaining, how to close the modal dialog when clicked outside. Please follow the below steps to achieve this: 1) D efine the following JavaScript function in the Function and Global Variable Declaration  section on the parent page (The page from which the modal dialog page is being called/opened). function closeModalDialogPage(element){ $('.ui-widget-overlay').click(function(){ $(element).dialog('close'); }); } Note: If you’re going to be using this in more than one place, its better to define it either on the page 0 or in a global JavaScript file. 2) Create an  open callback that will trigger the close dialog method when clicking outside the dialog.  We have to set call the function when the dialog opens. Define the below code in the  Attributes  section of the Modal Dialog page. op

Display and Edit CLOB Content in Oracle APEX

Image
In this post I will be explaining how to display  and edit a CLOB content in Oracle APEX.  Please follow the below steps: 1) Create a table T_EMPLOYEE CREATE TABLE T_EMPLOYEE ( EMP_ID NUMBER, EMP_NAME VARCHAR2(100), DESCRIPTION CLOB ); 2) Insert the required data into the T_EMPLOYEE table.                           3) Create a page in the application.  (In this example Page - 5) 4) Create another page with the Page Mode as Modal Dialog (In this example Page - 6)   5) Create a region and two items in Page - 6. The Items are:     P6_EMP_ID -> Type -> Hidden  (Value Protected: No)     P6_EMP_DESCRIPTION ->   Type  ->  Text Area   (or) Rich Text Editor 6) Now navigate back to Page - 5 and create a Region ( Type -> Interactive Report ) 7) Paste the below code in the Source -> SQL Query of the Interactive Report SELECT EMP_ID, EMP_NAME, 'Preview' as "PREVIEW" FROM T_EMPLOYEE; 8) Go to the PREVIW column

Creating a jQuery Dialog Alert in Oracle APEX

Image
In this post I will be explaining how to create a jQuery Dialog Alert  in Oracle APEX. Usually developers use the standard alert or apex.message to show an alert or confirm message.  When it comes to customized message box it is a better approach to create a jQuery Dialog Alert. Follow the below steps to achieve this: 1) Paste the below JavaScript code in the Function and Global Variable Declaration section. var openDialog = function (dTitle,dMessage ) { if ( !dTitle ) { dTitle = 'Dialog'; } if ( !dMessage ) { dMessage = 'No message to display...'; } $('<div></div>').html( dMessage ).dialog({ title: dTitle, dialogClass: "dialog-class", resizable: false,

Caps Lock On/Off indicator in Oracle APEX

Image
  In this post I will be explaining how to show Caps Lock On/Off indicator in Oracle APEX. Follow the below steps to achieve this: 1) Create a Page Item ( Type  of the item is  Password ).      Item Name: P33_PASSWORD (Use the item name in your page instead of this) 2) Paste the below CSS code in the  Inline  Section #caps-lock-div{ color:rgb(250, 76, 76); font-size: 1.3rem; line-height: 2rem; } 3) Paste the below JavaScript code in the  Function and Global Variable Declaration  section var password = document.getElementById("P33_PASSWORD"); var $password = $("#P33_PASSWORD").parent().parent(); var element = '<span id="caps-lock-div" class="fa fa-warning"> CapsLock key is on!</span>'; var capsLockCheck = function (event) { let $element = $('#caps-lock-div'); if (event.getModifierState("CapsLock")) { if($element.length == 0){ $password.append(elemen