Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 125331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:08:31+00:00 2026-05-11T05:08:31+00:00

With newer versions of DB2 you can write stored procedures in SQL or you

  • 0

With newer versions of DB2 you can write stored procedures in SQL or you can create procedures in Java (or other languages) that can then be added to the database and called just like SQL procedures. I’m wondering what the the pros and cons of each method are. I’m specifically interested in comparing those two types of procedures, not debating procedures versus external code which I think has already been covered. Here is what I’ve come up with so far:

SQL:

  • Better performance for basic SQL functionality

  • Less verbose for simple logic, i.e. you can run SQL directly

  • No extra compile step – just create procedure …

Java:

  • More structured and full-featured code (classes, objects, reuse, libraries)

  • Better resources for help both in terms of programmers and documentation

Any other thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:08:32+00:00Added an answer on May 11, 2026 at 5:08 am

    Not just Java but any procedural language: procedural, that’s the key.

    DB2 is a relational algebra, not a programming language. If you need to do something complex, it’s better to use a procedural language than try to bend SQL into something it’s not meant to be.

    We actually use REXX for our DB2/z work but I’ve seen guys here use bash on the mainframe for quick prototyping. Some who only use SQL create all these horrible temporary tables for storing things that are best kept in structures and away from the DB.

    My thoughts are that complexity is the only differentiating factor between using SQL directly in a stored procedure and a procedural approach. We have two rules of thumb when making these decisions.

    1/ If a unit of work requires more than two trips to the database, we make it a stored procedure.

    2/ If a stored procedures creates a temporary table, then we use a procedural language to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think that some newer languages like JS can do this natively, but I
is every varying vertex value (or in newer versions of glsl values that go
Is there an extension that would check whether there are newer versions available to
Does it matter to developers that the current, and newer versions of .Net don't
We've got an application using spring for making calls to DB2 stored procedures. The
I'm looking for a way to compare then possibly update (i.e. get newer versions
I've read that in older versions of SQL Server .. it had a pessimistic
I have some old Haskell code that includes QuickCheck test cases. Newer versions of
In older Python versions when you create a class, it can inherit from object
The newer versions of ColdFusion (I believe CF 8 and 9) allow you to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.