inflearn logo

Oracle Pro*C in One Book — Legacy Maintenance and Migration

We take a monthly seller settlement batch for a virtual shopping mall from start to finish. Using Pro*C fundamentals, we read the source, fix four hidden defects with minimal patches, reduce database round trips from 265,893 to 359 through array processing, then port it to ECPG and JDBC and prove that all three outputs are identical, line for line. We run every command directly against Oracle Database Free and PostgreSQL in Docker.

1 learners are taking this course

Level Intermediate

Course period Unlimited

Oracle
Oracle
PostgreSQL
PostgreSQL
SQL
SQL
DBMS/RDBMS
DBMS/RDBMS
database
database
Oracle
Oracle
PostgreSQL
PostgreSQL
SQL
SQL
DBMS/RDBMS
DBMS/RDBMS
database
database

What you will gain after the course

  • Build the Pro*C source and use the error message to determine whether the problem occurred during precompilation, compilation, linking, or execution.

  • Use host variables, VARCHAR, indicator variables, SQLCA, and WHENEVER correctly, including the pitfalls.

  • Fix the inherited batch’s commit placement, loop condition, NULL handling, and string defects with a minimal patch.

  • Prove that the fix using the expected-value SQL for the same rules and the set differences in both directions introduces no regressions.

  • Diagnose stalled batches using sessions and wait events, and make job history and exit codes easy for operators to read.

  • Reduce database round trips with array FETCH and INSERT, and determine array size, commit interval, and PREFETCH through actual measurements.

  • Port Pro*C to ECPG and JDBC, then compare the three results using CSV, MD5, and totals.

Taking Over a Pro*C Batch: Fix It, Speed It Up, and Migrate It to PostgreSQL and Java

Take a seller’s monthly settlement batch for a virtual shopping mall all the way through. Use Pro*C fundamentals to read the source, fix four hidden defects with minimal patches, and reduce database round trips from 265,893 to 359 with array processing. Then port it to ECPG and JDBC and prove that the three outputs are identical, line for line. Run every command directly on Oracle Database Free and PostgreSQL in Docker.

Pro*C still runs in overnight batch jobs across finance, retail, and the public sector, but the only places to learn it are Oracle’s manuals and scattered articles. Drawing on my experience writing a practical guide for working professionals, this course doesn’t just list syntax—it starts with “the batch I inherited stopped last night.” We recreate real issues: a settlement that committed once per seller and left only half the data, 13 sellers missed by an array FETCH loop, 13,513 orders that silently disappeared because of a NULL discount, and a report that carries over the previous name. Then we compare the results with expected-value SQL using the same rules to prove the fixes work. Finally, we port the same batch to PostgreSQL ECPG and Java JDBC, and check the differences that often cause problems after migration (empty strings, CHAR padding, integer division, sorting, and transaction aborts).

By the end of this course, you will be able to

  • Build Pro*C source code and use error messages to determine whether the problem occurs during precompilation, compilation, linking, or execution.

  • Use host variables, VARCHAR, indicator variables, SQLCA, and WHENEVER correctly, including their pitfalls.

  • Find defects in the inherited batch’s commit placement, loop conditions, NULL handling, and strings, and fix them with a minimal patch.

  • Prove there are no regressions in the corrected results using expected-value SQL under the same rules and set differences in both directions.

  • Diagnose stalled batches using sessions and wait events, and make work logs and exit codes easy for operators to understand.

  • Reduce database round trips with array FETCH and INSERT, and determine the array size, commit interval, and PREFETCH settings through actual measurements.

  • We migrate Pro*C to ECPG and JDBC, then compare the three outputs using CSV, md5, and totals.

Recommended for these readers

  • Developers/DBAs suddenly assigned to a Pro*C batch job

  • A developer responsible for migrating C batch jobs in an Oracle-to-PostgreSQL project.

  • For those who need a way to prove they “fixed it safely” before modifying a legacy batch job

  • People who know C and SQL but are new to embedded SQL.

Curriculum (6 sections · 41 lessons · approximately 303 minutes)

  • Section 0. Orientation — Preview the finished result first

  • Section 1. Pro*C Fundamentals and Practice Environment — Setting up the practice environment, your first Pro*C program, the two compilation stages and Makefile, diagnosing compilation errors, host variables and VARCHAR, indicator variables and NULL, connections and transactions, and pitfalls in data type mapping.

  • Section 2. Cursors and Error Handling — single-row SELECT INTO, reading multiple rows with cursors, pitfalls of WHENEVER, reading SQLCA, explicit error-handling patterns, dynamic SQL, PL/SQL calls and host structures

  • Section 3. Reading and Fixing Legacy Code — Exploring a legacy settlement batch, the order for reading code, Bug 1: commit placement, making batches safe to rerun, Bug 2: missing sellers, Bug 3: NULL discount amounts, Bug 4: garbled characters, regression testing after fixes, diagnosing a stalled batch, work logs and exit codes

  • Section 4. Batch Performance: Multiple Records at Once — The Cost of Processing One at a Time, Array FETCH, Array INSERT: FOR :n, Testing Array Sizes, Partial Failures During Array Processing, Commit Frequency and PREFETCH

  • Section 5. Migrating to PostgreSQL ECPG and Java — Planning the migration, moving the schema and data, your first ECPG program, implementing the settlement batch in ECPG, ECPG error handling and arrays, rewriting it in Java JDBC, comparing the three results, migration risks and rollback, and wrap-up: a practical checklist

Lab Environment

Oracle Database Free 23ai, a Pro*C development environment (Instant Client 23ai), PostgreSQL 17, an ECPG development environment, and Java 21 all start up at once with Docker (./up.sh). The virtual sports and outdoor specialty store “Loop Market” has 120 sellers and 200,000 ordered products, generated according to fixed rules. Run ./scenarios/sNN.sh for each lesson to see the same results as on screen. Every number and error message shown on screen in the lessons is the actual result of running this lab.

Prerequisites

  • C Fundamentals (enough to read pointers and structs)

  • SQL SELECT, INSERT, and UPDATE

  • A computer with Docker installed (Apple Silicon and Intel both supported)

What This Course Does Not Cover

  • Introduction to the C Programming Language

  • Oracle installation and administration

  • Advanced PL/SQL

  • Direct OCI Programming

  • Spring Batch

Notice

The slide narration is generated using a synthetic voice. All data are simulated for educational purposes, and numbers may vary depending on the execution environment.

Recommended for
these people

Who is this course right for?

  • Developers and DBAs suddenly tasked with a Pro*C batch

  • Developer responsible for migrating C batch jobs in a project moving from Oracle to PostgreSQL

  • For anyone who needs a way to prove they’ve 'fixed it safely' before fixing a legacy batch job.

  • For those who know C and SQL but are new to embedded SQL

Need to know before starting?

  • C Basics (at the level of reading pointers and structs)

  • SQL SELECT, INSERT, and UPDATE

  • A computer with Docker installed (both Apple Silicon and Intel)

Hello
This is dorian05202988

Career Verified

A data craftsman with over 20 years of experience in databases and IT. As a DBA and manager of a DB Platform team, I work with database platforms and specialize in MySQL, PostgreSQL, Oracle, MongoDB, SQL tuning, AWS, Terraform, and Python. Drawing on experience in the gaming, finance, and IT services industries, I explain database and cloud architecture. I have published 『Oracle Practical Tuning: Learning SQL Patterns』 and 『Oracle Pro*C Practical Project Guide』, and have presented on serverless architectures, database selection, and multi-database strategies at AWS Summit 2018 and 2019 and DataYa Nolja 2020. Recently, I have been working on slow-query analysis and tuning recommendations using Bedrock LLM, automated DB specification sizing, and query workflows through a DB metadata MCP server and Slack bot. I explain database automation for developers and AI applications for non-developers through hands-on exercises tailored to the audience and objectives of each course. Rather than applying AI suggestions as-is, I teach a decision-making framework that verifies result equivalence, execution plans, and observability conditions, and defers action when the supporting evidence is insufficient. Company operational data and credentials are not included in the course materials.

More

Curriculum

All

41 lectures ∙ (5hr 2min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

dorian05202988's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Limited time deal

$80,080.00

20%

$77.00