How to run PL/SQL Programs

What is pl/SQL ?

PL/SQL (Procedural Language/Structured Query Language), is a programming language designed to manage and manipulate data in Oracle databases. Including procedural features from programming languages expands SQL and enables programmers to create code that handles sophisticated data manipulation and transaction control inside the database.

Run pl/SQL programs

First of all, Oracle Database Express Edition (XE) must be installed on your computer to run PL/SQL programs.

Installation Link: XE Prior Release Archive (oracle.com)

Follow these steps after installing SQLplus.

Step 1: Open the command prompt and type sqlplus and then press enter.

Step 2: Enter username and password.

If an error occurs after entering the username and password

Then, close the command prompt & open it again, and type sqlplus /nolog

After this enter connect / as sysdba command

Step 3: On server output set serveroutput on; using this command

Step 4: Write your pl/sql code

DECLARE
   message  varchar2(20):= 'Hello, World!';
BEGIN
   dbms_output.put_line(message);
END;
/

Output: Hello, World!

Note: After writing the complete code, make sure to use forward slash ( / ) before executing the code. For example, see the line 6 in the given screenshots.

Thank you:)