Databases · DBC-02-14

Oracle Database: Introduction to PL/SQL

Oracle Database: Introduction to PL/SQL is a beginner course in Oracle's PL/SQL language on Oracle AI Database 26ai, from blocks, variables, conditions and loops to cursors, exception handling and stored procedures and functions, with labs based on real tasks. It suits developers, database staff and SQL users who want to write programs inside Oracle databases.

Updated
From 6,750 THB / person 7,500 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration12 hours · 2 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

Much of the work in organisations that run Oracle Database involves multi-step data processing, such as payroll calculations, end-of-day closing or moving data between tables. Written as one SQL statement at a time from the application side, this work is slow, hard to maintain and can leave data half-finished when something fails. PL/SQL is Oracle's procedural language, and it lets you run this logic inside the database in one place, with transactions and errors handled properly.

This course lays the foundations of PL/SQL on Oracle AI Database 26ai, Oracle's current release. Learners set up the free edition with SQL Developer for VS Code and SQLcl, then learn anonymous block structure, variables and data types including BOOLEAN, which now works in both SQL and PL/SQL, retrieving data, managing transactions, conditions and loops. The course continues with records, collections, cursors, BULK COLLECT and FORALL, exception handling, and creating stored procedures and functions. Every topic has a lab based on real tasks, and the course closes with a workshop that builds a data processing job from start to finish. (2 days, 6 hours per day, 12 hours in total, Beginner level.)

What you’ll gain

  • Set up an Oracle AI Database 26ai Free environment with coding tools on your own
  • Write anonymous blocks and use variables, data types, %TYPE and %ROWTYPE correctly
  • Retrieve and change data in PL/SQL and control transactions
  • Use conditions, loops, records and collections to solve data processing tasks
  • Process many rows efficiently with cursors, BULK COLLECT and FORALL
  • Handle exceptions and log errors so they can be investigated later
  • Create, call, change and drop stored procedures and functions

Who this course is for

  • Developers who write business logic or data processing jobs on Oracle Database
  • Database staff and administrators who need to read and change existing PL/SQL code
  • Data analysts and report developers who already use SQL and want to automate more of their work
  • Anyone starting out as an Oracle developer or DBA

Prerequisites

  • Basic SQL such as SELECT, WHERE, JOIN, INSERT and UPDATE
  • A basic understanding of tables, primary keys and foreign keys
  • No programming experience is required, although it will help you learn faster
  • A laptop that can run Docker Desktop or VirtualBox and VS Code, with permission to install software

Curriculum

Course Details

This course is the 2026 edition of Oracle Database: Introduction to PL/SQL, updated for Oracle AI Database 26ai, the current release that succeeds 23ai. It runs for 2 days, 6 hours per day (12 hours in total, 09:00-16:00), as lectures with a lab for every topic. Beginner level. Learners install Oracle AI Database 26ai Free on their own machine and write code with SQL Developer for VS Code and SQLcl. The course covers language basics, transactions, collections, cursors, BULK COLLECT, exceptions and stored procedures, and most of the code also runs on Oracle Database 19c. Learners take home a lab guide, SQL and PL/SQL scripts for every lab, and the workshop code.

Day 1 PL/SQL Language Basics and Working with Data

Section 1: Lab: Setting Up Oracle AI Database 26ai

  • Oracle AI Database 26ai Free and a short look at the CDB and PDB architecture
  • Run the database in a container or VM and create a user with DB_DEVELOPER_ROLE
  • Connect with SQL Developer for VS Code and SQLcl
  • Lab: install the sample schema and run your first statements

Section 2: Anonymous Block Structure

  • The DECLARE, BEGIN, EXCEPTION and END sections
  • Show output with DBMS_OUTPUT.PUT_LINE and SET SERVEROUTPUT ON
  • Nested blocks and variable scope
  • Lab: write a first block that calculates and displays a result

Section 3: Variables and Data Types

  • Scalar data types: NUMBER, VARCHAR2, DATE, TIMESTAMP and PLS_INTEGER
  • BOOLEAN, which works in both PL/SQL and SQL from release 23ai
  • Declare variables with %TYPE and %ROWTYPE, with constants and default values
  • Lab: store and calculate employee data with variables

Section 4: Lab: Retrieving Data and Managing Transactions

  • SELECT ... INTO and the errors raised when no rows or too many rows are found
  • INSERT, UPDATE, DELETE, RETURNING INTO and SQL%ROWCOUNT
  • COMMIT, ROLLBACK and SAVEPOINT in multi-step jobs
  • Lab: adjust salaries by rule and roll back when something goes wrong

Section 5: Lab: Conditions and Loops

  • IF ... ELSIF ... ELSE, and CASE as both a statement and an expression
  • Basic loops, WHILE loops, FOR loops, EXIT WHEN and CONTINUE WHEN
  • Newer iteration controls such as BY and WHEN in FOR loops
  • Lab: calculate tiered sales commission

Section 6: Functions and Data Type Conversion

  • Use SQL functions in PL/SQL for text, numbers and dates
  • TO_CHAR, TO_DATE and TO_NUMBER with format models
  • DEFAULT ... ON CONVERSION ERROR and VALIDATE_CONVERSION
  • Lab: check and convert imported data with inconsistent formats
Day 2 Cursors, Exceptions and Stored Procedures

Section 7: Records and Collections

  • PL/SQL records, and INSERT or UPDATE with a record
  • Associative arrays (INDEX BY tables), nested tables and VARRAYs
  • Initialise values with qualified expressions
  • Lab: hold working data in a collection and summarise it

Section 8: Lab: Explicit Cursors

  • Declare, OPEN, FETCH and CLOSE a cursor
  • Attributes: %FOUND, %NOTFOUND, %ROWCOUNT and %ISOPEN
  • Cursor FOR loops, parameterised cursors and FOR UPDATE
  • Lab: produce a report by department with a cursor

Section 9: Lab: Processing Large Volumes of Data

  • Context switches between the SQL engine and the PL/SQL engine
  • BULK COLLECT with LIMIT to keep memory under control
  • FORALL and SAVE EXCEPTIONS
  • Lab: compare row-by-row loops with bulk processing

Section 10: Handling Exceptions Systematically

  • Predefined and user-defined exceptions with PRAGMA EXCEPTION_INIT
  • RAISE_APPLICATION_ERROR, SQLCODE and SQLERRM
  • Log the error stack and backtrace to a log table
  • Lab: add error handling to the code from day one

Section 11: Lab: Stored Procedures and Functions

  • Create, call, change and drop procedures, with an introduction to packages
  • IN, OUT and IN OUT parameters
  • Create functions, call them from SQL and read compile errors with SHOW ERRORS
  • Lab: build procedures and functions that calculate and save data

Section 12: Workshop: The Execution Environment and Final Project

  • The PL/SQL engine, dependencies, INVALID objects, and definer versus invoker rights
  • Workshop: write a daily sales closing procedure with logging and transactions
  • Use an AI assistant to explain code, and verify the result before using it
  • A checklist before putting code into production

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

How does PL/SQL differ from SQL?

SQL issues individual statements to the database, such as SELECT, INSERT and UPDATE. PL/SQL is Oracle's procedural language built around SQL, adding variables, IF conditions, loops, exception handling and stored procedures and functions. It lets you run multi-step business logic inside the database in one go, reducing round trips between the application and the server.

What is the structure of an anonymous block in PL/SQL?

An anonymous block has four parts: DECLARE for variables and cursors (optional), BEGIN for the executable statements (required), EXCEPTION for error handling (optional), and END; to close it. In SQLcl or SQL Developer for VS Code, type / to run it, and use SET SERVEROUTPUT ON to see the output from DBMS_OUTPUT.PUT_LINE.

What are the steps to use a cursor in PL/SQL, and when should you use BULK COLLECT?

Declare the cursor with its SELECT statement in the DECLARE section, OPEN it, then FETCH ... INTO inside a loop to read one row at a time, exit when %NOTFOUND is true and CLOSE it. A cursor FOR loop does the opening, fetching and closing for you. For large volumes, fetch in batches with BULK COLLECT and LIMIT and write the results with FORALL, which cuts context switches between the SQL and PL/SQL engines and is much faster than row-by-row processing.

Who is the Oracle Database: Introduction to PL/SQL course for, and what should I know beforehand?

It suits developers, staff who look after Oracle databases, and SQL users who want to write logic inside the database. You should know basic SQL such as SELECT, JOIN, INSERT and UPDATE. No programming experience is required, and you should bring a laptop that can run Docker Desktop or a VM and VS Code for the labs.

What will I be able to do after the Oracle Database: Introduction to PL/SQL course?

You will be able to set up Oracle AI Database 26ai Free yourself, write anonymous blocks with variables and data types, manage transactions, write conditions and loops, use records, collections and cursors, process large volumes with BULK COLLECT and FORALL, handle exceptions with logging, and create, call and drop stored procedures and functions. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.

Can the Oracle Database: Introduction to PL/SQL course be run in-house for our team?

Yes. It can be run in-house for your team, with examples adapted to your own work, such as writing procedures for the data processing your team already handles. You can request a quotation from this page, or contact us on LINE @itgenius or by phone on 02-570-8449.

Related articles

Articles are published in Thai.