Introduction: Unlocking Data with Text-to-SQL

Generative AI promises to transform the way people and applications access, use, and understand data. With the help of GenAI, users should be empowered to solve their problems at the conceptual level of business terms and metrics that are most convenient to them, rather than at the data level that requires them to learn the details of domain specific query languages and database schemas, search and prune data, spend time on transforming data from one format to another, or be concerned with fusing diverse data and relating it to data outside the boundaries of their organization. A key step in facilitating this promise is the ability to transform natural language queries into SQL queries known as Text-to-SQL, or NL2SQL.

However, organizations have relied on databases as the system of record for daily operations and strategic decisions for years and the challenge of accessing this data via natural language interactions is massive and evades the direct use of even the top Large Language Models (LLMs). For example, top LLMs like GPT-5 scores on some of the key NL2SQL benchmarks such as Spider 2.0 are below 15%. Translating natural language queries to accurate, executable, SQL expressions is very difficult due to a multitude of reasons. These include challenges on the Database side – large and complex schemas that contain columns and tables with ambiguous and uninformative names, as well as challenges on the query side – queries often require decomposition into multiple primitive queries, thus necessitating an iterative generation process, and the need to support specific types of reasoning (arithmetic, temporal, counterfactual) that evade general purpose models.

Figure 1. Overview of Oracle Reasoning-based Natural Language to SQL Solution: (a) A Planner Agent with an optimized system prompt, incorporating meta-prompting and entity linking to resolve transliteration and mismatch issues. Diverse plans are generated for robustness. (b) A SQL Agent processes these plans, using retrieved schema and in-context examples to enhance quality, with a consistency verification step selecting the final output from the diverse SQL candidates.  Oracle AI is developing a new approach and a solution that addresses these NL2SQL challenges. Some aspects of our solution are being used in Oracle’s Reasoning-based Natural Language to SQL Solution – a Generative AI–based Agentic solution, that has just won the first place in the 2025 Archer NL2SQL Evaluation Challenge. This challenge involves natural language to SQL (NL2SQL) with complex reasoning over multiple databases, domains, tables, and languages. Oracle Reasoning-based Natural Language to SQL Solution not only outperformed global competitors by 9+ points in execution accuracy but also achieved parity between English and Chinese performance, a milestone in multilingual Text-to-SQL.
Figure 1. Overview of Oracle Reasoning-based Natural Language to SQL Solution: (a) A Planner Agent with an optimized system prompt, incorporating meta-prompting and entity linking to resolve transliteration and mismatch issues. Diverse plans are generated for robustness. (b) A SQL Agent processes these plans, using retrieved schema and in-context examples to enhance quality, with a consistency verification step selecting the final output from the diverse SQL candidates.

Oracle AI is developing a new approach and a solution that addresses these NL2SQL challenges. Some aspects of our solution are being used in Oracle’s Reasoning-based Natural Language to SQL Solution – a Generative AI–based Agentic solution, that has just won the first place in the 2025 Archer NL2SQL Evaluation Challenge. This challenge involves natural language to SQL (NL2SQL) with complex reasoning over multiple databases, domains, tables, and languages. Oracle Reasoning-based Natural Language to SQL Solution not only outperformed global competitors by 9+ points in execution accuracy but also achieved parity between English and Chinese performance, a milestone in multilingual Text-to-SQL.

 

Why Archer Matters

While the Oracle Reasoning-based Natural Language to SQL Solution only exposes some aspects of the Oracle SQL solution, the success of this solution in Archer is very significant, since the Archer benchmark raises the bar for Text-to-SQL by introducing reasoning challenges that go beyond simple schema lookups. Understanding Archer queries requires:

  • Arithmetic reasoning (e.g., ratios, percentages, growth rates)
  • Commonsense inference (implicit facts about entities or conditions)
  • Hypotheticals and counterfactuals (“If all X had Y, what follows?”)
  • Bilingual execution (English + Chinese queries across the same DBs)

Success requires not only correct SQL syntax (validity) but also valid execution accuracy (EX): whether the SQL returns the right answer.

 

Oracle’s Solution: Reasoning-based Natural Language to SQL Solution

Oracle Reasoning-based Natural Language to SQL Solution takes a planning-centric multi-agent approach to NL2SQL. Instead of directly mapping text → SQL, it introduces an explicit intermediate step with planning agent that returns a natural language plan. This plan is then converted to the SQL statement by the SQL agent.

  1. Planner Agent
    1. Decomposes a user query into reasoning steps.
    2. Refines the plan through feedback-guided meta-prompting: error cases are clustered and distilled into guidelines that improve generalization.
    3. Integrates entity-linking guidelines to ensure accurate handling of multilingual and transliterated terms (e.g., “约翰·尼斯尼克” translated to “John Nisinik” when the correct mapping is “John Nizinik” in English) and handles alternative entity names.
  2. SQL Agent
    1. Converts natural language plans into executable SQL, enriched with retrieved schema and in-context examples.
    2. Ensures syntactic and semantic validity.
  3. Robustness via Diversity
    1. Multiple candidate plans are generated per query.
    2. Their SQL outputs are executed, and a consistency verification step is used to select the most reliable answer.

 

Results: First Place at Archer 2025

Oracle Reasoning-based Natural Language to SQL Solution ranked #1 overall on Archer’s bilingual leaderboard: It outperformed the 2025 runner-up HIT–SCIR, improving execution accuracy by 6.3 points in English (54.96% vs. 48.66%) and 12.6 points in Chinese (56.67% vs. 44.08%) on the test set (seen in Figure 2), closing the cross-lingual gap observed in prior systems. 

 

 

Figure 2. Archer NL2SQL Challenge 2025 leaderboard official results on the unseen test set (Execution Accuracy %). Our Oracle Reasoning-based Natural Language to SQL Solution consisting of planner agent and SQL agent (that utilizes GPT-5 as the underlying model) achieves the best performance across all other participants.
Figure 2. Archer NL2SQL Challenge 2025 leaderboard official results on the unseen test set (Execution Accuracy %). Our Oracle Reasoning-based Natural Language to SQL Solution consisting of planner agent and SQL agent (that utilizes GPT-5 as the underlying model) achieves the best performance across all other participants.

Notably, Oracle’s framework maintained >99% SQL validity, proving both reliable and accurate across languages.

 

Key Innovations

  • Meta-Prompting with Feedback: A lightweight alternative to multi-agent orchestration. By refining the planner’s system prompt with human and model feedback, Oracle Reasoning-based Natural Language to SQL Solution improves reasoning accuracy by 28 points in English compared to an unrefined planner, as shown in Figure 3a and Figure 3b (Ablation Study for English).
ablation result with vanilla
Figure 3a. Ablation and model comparison studies for Oracle Reasoning-based Natural Language to SQL Solution (underlying model: GPT-5) on the development set. The ablation study on English development set evaluates the contribution of the planner module and the effect of refining its system prompt. Removing the planner module results in a substantial performance drop, confirming its necessity for effective reasoning. Further, replacing the optimized planner prompt with a simplified version that omits targeted guidelines derived from feedback-guided meta-prompting leads to an additional (significant) decline, demonstrating the importance of prompt refinement. We also compare Oracle Reasoning-based Natural Language to SQL Solution (GPT-5) with vanilla GPT-5, highlighting the performance gains introduced by our overall multi-agent components.

 

ablation study
Figure 3b. Comparison between Oracle Reasoning-based Natural Language to SQL Solution (GPT-4o), where the underlying model is replaced with GPT-4o, and HIT–SCIR (GPT-4o), the second-best performing team using the same base model, on the English and Chinese development sets. Oracle Reasoning-based Natural Language to SQL Solution consistently outperforms even with GPT-4o, indicating that the gains arise from our proposed framework rather than solely from the stronger reasoning capabilities of GPT-5.

 

  • Entity Linking for Multilingual Robustness: Oracle’s solution closes the English Chinese performance gap, where prior systems struggled with transliteration mismatches. We plan to extend our framework to all languages to reduce entity mismatch issues caused by different forms of the same expression, such as ‘NYC’ and ‘New York City’.
  • Plan Diversification & Consensus: Inspired by ensemble principles, Oracle Reasoning-based Natural Language to SQL Solution reduces bias towards a single-plan by relying on diverse candidate plans and execution-based voting.

 

Enterprise Implications

Winning a benchmark is exciting, but what does it mean for Oracle customers?

  • Natural Enterprise Queries: Business users can ask counterfactual questions such as: “What’s the YoY growth of premium accounts in APAC?” and get accurate SQL-backed results.
  • Multilingual Support: Global enterprises can query in both English and Chinese without accuracy loss. Our solution will be generalized to support additional languages.
  • Trustworthy Outputs: By combining planning, entity linking, and consistency verification, Reasoning-based Natural Language to SQL Solution reduces “reasoning-based errors” – wrong answers hidden in valid-looking SQL.

This aligns directly with Oracle’s vision: making GenAI-powered data access both intuitive and enterprise-grade.

 

Looking Forward

Oracle Reasoning-based Natural Language to SQL Solution shows that planning-first NL2SQL agents can outperform direct generation approaches. OraSQL is being integrated into our product level solution for NL2SQL. Some of the future directions include:

  • Scaling to multi-dialect SQL beyond Archer (e.g., PL/SQL).
  • Integrating with Oracle Fusion applications for natural, cross-domain querying.

 

Conclusion

  • With Reasoning-based Oracle Natural Language to SQL Solution, Oracle demonstrated its emphasis on developing innovative Generative AI solutions to critical business problems. Some aspects of our general solution that are exhibited in Oracle Reasoning-based Natural Language to SQL Solution, illustrates how thoughtful planner optimization, feedback-driven refinement, and multilingual entity linking can break through barriers in Text-to-SQL.
  • By winning Archer 2025, we not only set a new state-of-the-art, but also showcased how Oracle’s GenAI is shaping the future of enterprise data access: accurate, multilingual, and trustworthy.