PL/SQL Program to Calculate Factorial

Here is an example of a PL/SQL program to calculate the factorial of a given number: PL/SQL Program to Calculate Factorial Example DECLARE num INTEGER := 5; factorial INTEGER := 1; BEGIN -- Calculate the factorial of the given number FOR i IN 1..num LOOP factorial := factorial * i; END LOOP; -- Print the ... Read more

PL/SQL Procedure Example

A procedure is similar to a PL/SQL block, but it has a name and is stored in the database permanently. The schema object is the main way that business logic is implemented on the server side. By breaking up complex logic into simple routines, a procedure helps a modular programming method. The most important things ... Read more

Exception Handling in PL/SQL

In this tutorial, you will learn about exceptions in PL/SQL and how to write code to handle them. One of the most crucial stages of developing a database application is handling exceptions. Unhandled exceptions pose a threat to application availability, disrupt business operations, and annoy users. In PL/SQL, an exception can be either predefined by ... Read more

Oracle Cursor FOR LOOP Insert Example

In this tutorial, I'll show you how to insert records into a table in Oracle using FOR LOOP on the cursor. Suppose you have the following table (emp_Sal): create table emp_sal ( empno number, sdate date, sal number, comm number, total_sal number ); Cursor FOR LOOP Insert Example And in this table, you need to ... Read more

PL/SQL Cursor FOR LOOP Examples

In PL/SQL, FOR loop allows for easy iteration over a cursor object's entire set of records. A CURSOR FOR loop is a FOR loop that initiates the opening of a cursor. The CURSOR FOR loop eliminates the need for the programmer to explicitly define the cursor's OPEN, FETCH, and CLOSE operations, thereby saving time. Cursor ... Read more

What is Cursor in PL/SQL?

In this tutorial, you will learn, what is cursor in PL/SQL and how it works. One of the most important aspects of database programming is writing SQL in PL/SQL. All SQL statements contained within a PL/SQL block are processed as cursors. A cursor is a private memory area used for SQL statement processing that is ... Read more

DUO Two Factor Authentication Using PL/SQL

DUO two factor authentication using PL/SQL.

This tutorial will teach you how to integrate DUO Two Factor Authentication using PL/SQL in the Oracle database. What is Two Factor Authentication? Two-factor authentication (2FA) is a method by which users can verify their identity by using two different forms of identification, such as a password and an additional piece of information. The idea ... Read more

How to Get Table Definition in Oracle?

Use dbms_metadata.get_ddl() function to get the table definition in Oracle. Below is an example: DBMS_METADATA.GET_DDL() Example The following SQL query will get the table definition for the EMP table in the current schema of Oracle Database: select DBMS_METADATA.GET_DDL('TABLE','EMP') from DUAL; Output: CREATE TABLE "FJ22CDVLZSYLNS"."EMP" ( "EMPNO" NUMBER(4, 0) NOT NULL ENABLE, "ENAME" VARCHAR2(10), "JOB" VARCHAR2(9), ... Read more

PL/SQL Online MCQ Quiz

Oracle PL/SQL Diagram.

Below is the PL/SQL Online MCQ Quiz. It shows the basic ten multiple-choice questions of PL/SQL programming and lets you choose the answer on a single page. And once you click on the Finish button at the end, it will display the results with the correct and wrong answers. So let's start the quiz: