Oracle Database is one of the most widely used database systems, and a substantial amount of enterprise software is written in PL/SQL, a procedural extension for the SQL language and Oracle relational databases. This code implements business rules, validates records, generates reports, handles errors, and coordinates database operations. Developing and maintaining it is an important part of enterprise software engineering. 

Language models can assist developers in creating and maintaining PL/SQL code. However, despite the widespread use of PL/SQL, we have lacked a dedicated benchmark for evaluating whether these models can generate, modify, and repair executable PL/SQL programs correctly. General programming benchmarks assess models’ ability to generate code in languages such as Python, Java, and C++. Text-to-SQL benchmarks assess their ability to translate natural-language requests into declarative SQL queries. None directly measure the combination of database knowledge and procedural programming needed for PL/SQL development. 

Overview of PLSQLBench and an example of multi-turn PL/SQL development with unit-test validation at each turn. 

Figure 1. Overview of PLSQLBench and an example of multi-turn PL/SQL development with unit-test validation at each turn. 

To address this gap, Oracle and Turing collaborated on PLSQLBench, a dataset and benchmark focused on executable procedural database programming. It is the execution-based benchmark spanning single-turn generation and multi-turn modification and repair of Oracle PL/SQL programs. It extends evaluation beyond template-instantiated Oracle procedure generation to individually curated, execution-tested development workflows over enterprise-style schemas.  

The detailed description of PLSQLBench can be found in our paper accepted at the EMNLP 2026 Industry Track. In this post, we explain how we built the benchmark, how we measure correctness, and what the results tell us about AI-assisted database development. 

Evaluating enterprise database development 

Enterprise database development involves more than answering a question with a query. Developers create reusable procedures, functions, and packages that operate over existing schemas. These programs combine SQL with variables, branching, loops, cursors, and exception handling. Their correctness depends on both the requested business logic and the database objects they use. 

Moreover, development rarely ends with the first implementation. A procedure may need a new parameter, an additional validation rule, or a fix for an unexpected input. These changes must preserve the behavior that callers already depend on. A model that implements the latest request but drops an earlier requirement can introduce a bug into an otherwise working program. 

For example, a developer might ask for a procedure that reports the top-selling products, then request date-range filtering, and finally add inventory checks. Completing this workflow requires the model to understand the schema, implement the procedural logic, and preserve earlier requirements across successive revisions. 

PLSQLBench includes code generation, code repair, and multi-turn development tasks that examine these capabilities. Its primary enterprise-style subsets use databases adapted from Spider 2.0 Lite. Complementary subsets use simpler schemas and standalone programming problems to examine different sources of difficulty. 

Figure 1 illustrates the PLSQLBench benchmark suite and a representative multi-turn development workflow. The suite brings together database schemas, reference PL/SQL programs, user requests, and executable unit tests for code generation, code repair, and interactive development. In the example, successive requests extend a product-reporting procedure with date-range filtering and stock availability checks. Each revision is validated through unit tests, assessing whether the model implements the new requirement while preserving earlier behavior. 

What is in the dataset? 

PLSQLBench contains 2,865 instances: 2,594 single-turn tasks and 271 multi-turn conversations spanning 978 turns. It combines three source families—Spider 2.0 Lite, Spider 1.0, and MBPP/MBPP+—into five subsets. 

Subset Focus Instances 
Spider2-ST Single-turn generation and repair over enterprise-style schemas 510 
Spider2-MT Multi-turn development over enterprise-style schemas 271 conversations 
Spider-PLSQL PL/SQL programs answering Spider 1.0 questions 970 
MBPP-PLSQL Short programming problems adapted to PL/SQL 806 
MBPP+-PLSQL Programming problems evaluated with expanded tests 308 

The subsets serve complementary purposes. The Spider-derived tasks require models to use database schemas correctly. The MBPP-derived tasks focus more directly on procedural programming and do not require persistent database tables, although some use Oracle object or collection types. Together, they let us examine difficulties involving database context, programming logic, and their combination. 

Constructing the dataset required more than translating prompts. We normalized schemas and data from SQLite, Snowflake, and BigQuery into Oracle-compatible representations. This included converting data types, identifiers, and date literals. 

For the Spider 2.0 subsets, Oracle PL/SQL experts created task specifications, reference PL/SQL programs, and executable tests. All tasks underwent automated review, and over 60% received human review, with rework as needed to meet a 5/5 acceptance criterion. A separate LLM-as-judge check of individual turns yielded batch acceptance rates of 89.55%–94.11%, with identified issues also reworked.  

For MBPP and MBPP+, we used a rule-based conversion of Python tests into executable PL/SQL tests and validated the resulting test harnesses in Oracle. For the more challenging MBPP+ dataset, an “oracle” generation experiment showed that passing PL/SQL solutions could be generated for at least 87% of problems. 

The Spider 2.0 development and test splits use separate databases. This allows us to evaluate performance on database contexts held out from the development split. 

Measuring behavior through execution 

A program can compile successfully and still produce incorrect results. PL/SQL also allows different implementations of the same behavior, so textual similarity to a reference program is not a sufficient measure of correctness. We therefore evaluate generated programs by executing tests in Oracle Database. 

For Spider 2.0 tasks, we run the tests against both the reference program and the generated program, then compare their outputs. For Spider-PLSQL, the expected results come from the original gold SQL queries. The MBPP-derived tests encode inputs and expected outputs directly in PL/SQL. 

We report both partial-credit and strict metrics. Our main metric, Mean Test Pass@1, measures the fraction of tests passed by a single generated solution, averaged across tasks or conversations. Suite Pass@1 counts a task as solved only when all its tests pass. For multi-turn development, Episode Pass@1 requires every turn in a conversation to pass all its tests. 

This distinction is important. Passing most tests can indicate useful progress, but it does not mean that most tasks are completely solved. Similarly, handling individual revisions reasonably well does not necessarily translate into completing an entire development session correctly. 

Multi-turn evaluation carries forward the model’s own earlier responses and the database objects created by those responses. Later turns therefore encounter the consequences of earlier generations, including mistakes. 

Model MBPP+ Spider2-ST Spider2-MT Test Mean 
Open-weight models 
Llama-4-Maverick 26.30 61.24 52.85 46.80 
Gemma-4-31B 39.94 76.26 70.57 62.26 
Proprietary models 
Gemini-2.5-Flash-Lite 33.44 60.94 56.78 50.39 
Grok-4.3 38.31 66.98 65.46 56.92 
GPT-5.4-Mini 38.96 70.90 65.94 58.60 
GPT-5.4 42.21 79.47 73.19 64.96 
GPT-5.6-Sol 46.75 71.57 66.81 61.71 
Claude-Opus-4.8 47.73 76.34 66.40 63.49 

Table 1. Main PLSQLBench results for the test split. All values are Mean Test Pass@1 (%). Test Mean is the unweighted average across the three test subsets. Best results in each column are shown in bold. 

What the experiments show 

We evaluated eight proprietary and open-weight models: Gemma-4-31B, Llama-4-Maverick, Gemini-2.5-Flash-Lite , Grok-4.3, Claude-Opus-4.8, GPT-5.4-Mini, GPT-5.4, GPT-5.6-Sol. 

Main experimental results are presented in Table 1. Among models generating code directly, GPT-5.4 achieved the highest Mean Test Pass@1 across the three test subsets at 64.96%, followed by Claude Opus 4.8 at 63.49%. Gemma 4 31B was competitive at 62.26%. Performance varied across subsets, and no single model led on every task family. 

Model Mean Test Pass@1 Episode Pass@1 Turn Suite Pass@1 
Open-weight models 
Llama-4-Maverick 52.85 15.87 39.47 
Gemma-4-31B 70.57 30.16 54.39 
Proprietary models 
Gemini-2.5-Flash-Lite 56.78 19.05 42.98 
Grok-4.3 65.46 28.57 51.75 
GPT-5.4-Mini 65.94 23.81 50.88 
GPT-5.4 73.19 33.33 59.21 
GPT-5.6-Sol 66.81 22.22 50.00 
Claude-Opus-4.8 66.40 28.57 52.63 
Tool-augmented agents 
GPT-5.4-Mini + Codex DB Agent 75.72 28.57 56.14 
GPT-5.6-Sol + Codex DB Agent 81.29 41.27 64.91 

Table 2. Spider2-MT strict multi-turn test-split results (%). Episode Pass@1 requires every turn in a conversation to pass all unit tests, while Turn Suite Pass@1 measures suite-level success at the individual-turn level. Codex DB Agent uses medium reasoning; bold denotes the best result in each column. 

For Spider 2 single- and multi-turn datasets, these are partial-credit scores. Under the stricter multi-turn metric (see Table 2), the best direct-generation model (GPT-5.4) completed only 33.33% of test conversations with every test passing at every turn. Thus, a model can solve much of a workflow while still making an error that prevents the complete conversation from succeeding. 

We also evaluated tool-augmented agents using Codex CLI, Oracle SQL/PLSQL skills, and database tools. Database interaction improved performance on the Spider 2.0 subsets for both evaluated model backbones. For GPT-5.6-Sol, the multi-turn mean test score increased from 66.81% to 81.29%. Its complete-conversation success rate increased from 22.22% to 41.27%. 

These improvements are substantial. However, even the strongest evaluated agent completed fewer than half of the multi-turn conversations without error. Improvements also did not extend uniformly to the MBPP-derived evaluation, suggesting that the benefits of database interaction depend on the task. 

Our error analysis provides some insight into the remaining difficulties. Approximately 82.5% of categorized model failures involved incorrect procedure logic or output. Invalid or incomplete PL/SQL accounted for 13.3%, while interface, signature, or schema errors accounted for 4.2%. 

One example involved a reporting procedure that compiled but skipped required report headers when its cursor returned no rows. The generated code raised an exception before printing the headers. The procedure contained plausible querying and exception-handling code, but their ordering changed its observable behavior. A compilation check alone would not have caught this problem. 

What this means for AI-assisted database development 

The results suggest that language models can provide useful assistance with PL/SQL development, especially when they have access to database tools. At the same time, reliability across complete tasks and successive changes remains a significant challenge. For enterprise development, preserving an interface or handling an empty result correctly can be just as important as implementing the main computation. 

PLSQLBench covers a limited part of this work. Its tasks avoid persistent inserts, updates, and deletes, which keeps evaluation repeatable. Production systems introduce additional demands involving transactions, permissions, performance, legacy dependencies, and deployment. Passing the available tests also does not establish correctness for every possible input. 

Nevertheless, the benchmark gives us a concrete way to measure capabilities that existing coding and text-to-SQL evaluations leave largely unexamined. Given the substantial investment in enterprise PL/SQL software, we think these capabilities deserve much more attention. 

Researchers and developers can explore the public PLSQLBench repository, which contains 2,391 development instances and supporting schema artifacts. The remaining 474 instances are private evaluation holdouts. We hope this work helps the community develop more reliable tools for creating, debugging, and maintaining enterprise database programs. 

Links 

  1. PLSQLBench: Benchmarking LLM Systems for Executable Procedural Database Programming. Accepted at EMNLP 2026 Industry track. 
  1. Turing’s Frontier AI Newsletter describing this collaboration