Oracle Before Insert OR Update Trigger Example

The following is an Oracle BEFORE INSERT OR UPDATE Trigger example to perform validations while inserting or updating the records in EMP table. Oracle BEFORE INSERT OR UPDATE Trigger Example The below trigger will do the following two checks on…

Oracle Trigger WHEN Clause Example

In this article, you will learn how to use WHEN clause in Oracle trigger to make the trigger fire on the specified condition. Below is an example. You can test this trigger example by creating the following table and trigger…

Table Type in Oracle Stored Procedure Example

The following is an example of Oracle stored procedure, in which table type collection is used to process the data. Process Data Using Table Type in Oracle Stored Procedure Example Create the following tables and insert the data to test…

How to Compare Two Database Objects in Oracle?

In this tutorial, I am giving an example to compare two database table objects of different schemas using the DBMS_COMPARISON utility package in Oracle. Steps to Compare Two Table Objects in Oracle Using DBMS_COMPARISON Step-1 Create the comparison using DBMS_COMPARISON. In…

How to Get Current Date in PL/SQL?

The following are the examples to get the current date in PL Examples To Get The Current Date in PL/SQL 1. Using Sysdate Function SET SERVEROUTPUT ON; DECLARE d_current_date DATE; BEGIN d_current_date := SYSDATE; DBMS_OUTPUT.put_line ('The Date today is: '…

Resolve PLS-00323 Error in Oracle

The reason for the PLS-00323 error in Oracle is a mismatch in procedure or function declaration in the package specification and the package body. To resolve this take the following actions. Resolve PLS-00323 Error in Oracle Check the package specification…

How to Create Function in PL/SQL?

To create a function in PL/SQL, use CREATE OR REPLACE FUNCTION statement. Below are the syntax details and an example. Syntax CREATE [OR REPLACE] FUNCTION function_name [(parameters)]  Return data_type is /* declare variables here */ Begin /* write program logic…

How to Split a String in PL/SQL?

In this article, I am giving an example of a function which I mostly use to split a string in PL Especially, when I am writing a program to import a delimited file. Here are that function and an example…

Java in Oracle Database Example

In this tutorial, I am giving an example to implement Java code in Oracle Database using the stored function. We can create Java programs in the Oracle database by using CREATE OR REPLACE AND COMPILE JAVA SOURCE statement. After that, we can…

Oracle FOR LOOP SELECT Statement Example

In this tutorial, I am giving an Oracle FOR LOOP SELECT statement example. You can use SELECT statement inside FOR LOOP in Oracle to loop through SELECT results using PL FOR LOOP IN SELECT Syntax FOR cursor_variable IN (select_statement) LOOP…

Oracle IF Condition Example

In Oracle PL/SQL, IF condition is used to perform a logical check on certain values. If the condition is TRUE or FALSE then executes the statements followed by that condition. In this blog post, I am giving an Oracle IF…

Oracle WHILE LOOP Example

In Oracle PL/SQL, WHILE LOOP statement executes the code written between WHILE LOOP and END LOOP until the condition is true. Below I am giving some examples for Oracle WHILE LOOP statement. Syntax WHILE logical_condition LOOP -- some PL/SQL code END…

Oracle FOR LOOP REVERSE Example

In Oracle PL/SQL, FOR LOOP with REVERSE clause is used to repeat loop iteration in reverse order. The following are the syntax and examples for REVERSE FOR LOOP. Syntax FOR n IN REVERSE start_number .. end_number LOOP -- statement to execute…

How to Compile All Invalid Packages in Schema?

Below is an example of PL/SQL program to compile all invalid package specifications and all invalid package bodies for the current user (SCHEMA) in Oracle. Also, if any of the invalid packages are not successfully compiled then it will print…