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…

PL/SQL Program to Print Employee Details

In this tutorial, you will learn how to print employee details using PL/SQL program. PL/SQL Program to Print Employee Details In the following example, it will print the employee details for the employee number 7839, set in the declare section…

UTL_FILE.FREMOVE Example: Delete a File in Oracle

In Oracle PL/SQL, UTL_FILE.FREMOVE procedure is used to delete a file from the disk. This tutorial explains how to delete a file in Oracle PL/SQL using UTL_FILE.FREMOVE procedure with syntax and example. Syntax UTL_FILE.FREMOVE ( location IN VARCHAR2, filename IN…

Oracle PL/SQL: UTL_FILE.FCOPY Example

In Oracle PL/SQL, UTL_FILE.FCOPY procedure is used to copy a file. This article explains how to copy a file in PL/SQL using UTL_FILE.FCOPY procedure with syntax and examples. Syntax UTL_FILE.FCOPY ( src_location IN VARCHAR2, src_filename IN VARCHAR2, dest_location IN VARCHAR2, dest_filename…

How to Raise Exception in PL/SQL?

You can raise an error in PL/SQL using user-defined exception. Steps to Raise An Exception in PL/SQL Declare user-defined exception in the declare section of PL/SQL program unit. Raise it between the program upon some condition. Handle it in the…

utl_file.fopen Parameters in Oracle

In Oracle utl_file.fopen is a function, which opens a file on the server by returning its file handle. Function utl_file.fopen parameters in Oracle are as follows: utl_file.fopen Syntax UTL_FILE.FOPEN ( location IN VARCHAR2, filename IN VARCHAR2, open_mode IN VARCHAR2, max_linesize…

PL/SQL - Raise Application Error Example

An example is given here to raise application error (raise_application_error) in PL/SQL stored procedure if the certain condition does not match. The program will raise an exception if the commission (comm) is null in EMP table for given employee number…

How to Execute Function in Oracle With Parameters

In Oracle, you can execute a function with parameters via the following ways: 1. Execute The Function Using Select Statement SELECT get_emp_job (7566) FROM DUAL; Output GET_EMP_JOB(7566) ---------------------------------------- MANAGER 1 row selected. 2. Execute The Function Using PL/SQL Block SET…