• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
AimactGrow
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
AimactGrow
No Result
View All Result

Calling Procedures with Default Parameters utilizing JDBC or jOOQ – Java, SQL and jOOQ.

Admin by Admin
May 11, 2025
Home Coding
Share on FacebookShare on Twitter


Utilizing jOOQ’s code generator to name saved procedures is a well-liked cause to make use of jOOQ. For instance, when you’ve a process like the next Oracle PL/SQL process:

CREATE OR REPLACE PROCEDURE p (
  p_i1 IN quantity,
  p_o1 OUT quantity,
  p_i2 IN varchar2,
  p_o2 OUT varchar2
)
IS
BEGIN
  p_o1 := p_i1;
  p_o2 := p_i2;
END;

jOOQ will generate code so that you can name very merely, like this:

// Configuration comprises your JDBC Connection, and different issues
P outcome = Routines.p(configuration, 1, "A");
System.out.println(p.getPO1());
System.out.println(p.getPO2());

This can execute the next, taking good care of binding all IN and OUT parameters for you:

{ name "TEST"."P" (?, ?, ?, ?) }

The output of this system is:

1
A

Now, what in case you’re including DEFAULT values to your process (or operate) signature?

CREATE OR REPLACE PROCEDURE p (
  p_i1 IN quantity := 1,
  p_o1 OUT quantity,
  p_i2 IN varchar2 := 'A',
  p_o2 OUT varchar2
)
IS
BEGIN
  p_o1 := p_i1;
  p_o2 := p_i2;
END;

In your Java code above, there’s no strategy to omit the parameter of the Routines.p() name, however in case you have a look at the generate implementation of Routines.p(), you may see that that is simply comfort for utilizing positional parameter indexes (as we’re used to do in Java). You’ll be able to at all times instantiate the process name instantly, like this – there’s no technical distinction between the 2 methods to name the process:

P p = new P();
p.setPI1(2);
p.setPI2("B");
p.execute(configuration);
System.out.println(p.getPO1());
System.out.println(p.getPO2());

With the above syntax, you may omit any parameter that you understand is defaulted, e.g.:

P p = new P();
p.setPI1(2);
p.execute(configuration);
System.out.println(p.getPO1());
System.out.println(p.getPO2());

Now, as an alternative of the JDBC escape syntax, jOOQ will render an nameless block like this:

start
  "TEST"."P" ("P_I1" => ?, "P_O1" => ?, "P_O2" => ?)
finish;

Word how P_I2 isn’t being handed explicitly to the process name.

The output is:

2
A

This works on any RDBMS that helps default parameters, every with their very own particular syntax to move parameters by title, together with no less than:

  • Db2
  • Informix
  • Oracle
  • PostgreSQL
  • SQL Server

Like this:

Like Loading…

Tags: CallingdefaultJavaJDBCjOOQparametersProceduresSQL
Admin

Admin

Next Post
Magic: The Gathering – Closing Fantasy Sequence’ Mechanics And Key phrases Defined

Magic: The Gathering - Closing Fantasy Sequence' Mechanics And Key phrases Defined

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

SquidLoader Malware Marketing campaign Hits Hong Kong Monetary Corporations

SquidLoader Malware Marketing campaign Hits Hong Kong Monetary Corporations

July 20, 2025
Madden NFL 26 For PS5 And Change 2 Drops To Finest Value But

Madden NFL 26 For PS5 And Change 2 Drops To Finest Value But

November 3, 2025

Trending.

AI-Assisted Menace Actor Compromises 600+ FortiGate Gadgets in 55 Nations

AI-Assisted Menace Actor Compromises 600+ FortiGate Gadgets in 55 Nations

February 23, 2026
10 tricks to begin getting ready! • Yoast

10 tricks to begin getting ready! • Yoast

July 21, 2025
Exporting a Material Simulation from Blender to an Interactive Three.js Scene

Exporting a Material Simulation from Blender to an Interactive Three.js Scene

August 20, 2025
Moonshot AI Releases 𝑨𝒕𝒕𝒆𝒏𝒕𝒊𝒐𝒏 𝑹𝒆𝒔𝒊𝒅𝒖𝒂𝒍𝒔 to Exchange Mounted Residual Mixing with Depth-Sensible Consideration for Higher Scaling in Transformers

Moonshot AI Releases 𝑨𝒕𝒕𝒆𝒏𝒕𝒊𝒐𝒏 𝑹𝒆𝒔𝒊𝒅𝒖𝒂𝒍𝒔 to Exchange Mounted Residual Mixing with Depth-Sensible Consideration for Higher Scaling in Transformers

March 16, 2026
Introducing Sophos Endpoint for Legacy Platforms – Sophos Information

Introducing Sophos Endpoint for Legacy Platforms – Sophos Information

August 28, 2025

AimactGrow

Welcome to AimactGrow, your ultimate source for all things technology! Our mission is to provide insightful, up-to-date content on the latest advancements in technology, coding, gaming, digital marketing, SEO, cybersecurity, and artificial intelligence (AI).

Categories

  • AI
  • Coding
  • Cybersecurity
  • Digital marketing
  • Gaming
  • SEO
  • Technology

Recent News

Justin Fulcher on AI’s Function in Modernizing Authorities Operations

Justin Fulcher on AI’s Function in Modernizing Authorities Operations

March 18, 2026
Main search engine optimization Firm in St. Catharine

Main search engine optimization Firm in St. Catharine

March 18, 2026
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved