?
Solved

How to change Oracle SP to UDB SP in Visual Age for JAVA?

Posted on 2002-05-29
4
Medium Priority
?
229 Views
Last Modified: 2010-03-31
my original source is used for ORACLE :

    sql =  " DECLARE";
    sql += "     CURSOR line is";
    sql += "         " + SelectStatment + ";";
    sql += "     lrec line%ROWTYPE;";
    sql += " CNT     NUMBER(7):=1;";
    sql += " BEGIN";
    sql += "     OPEN line;";
    sql += "     WHILE CNT <= " + PersonCount + " LOOP";
    sql += "         FETCH line INTO lrec;";
    sql += "         EXIT WHEN line%NOTFOUND;";
    sql += "       " + InsertStatment + ;";
    sql += "         CNT := CNT + 1;";
    sql += "     END LOOP;";
    sql += "     CLOSE line;";
    sql += " END; ";
   
    db.executeUpdate(sql);

How can I change this SP to avaliable for UDB?

0
Comment
Question by:ChristBoy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Jim Cakalic earned 2000 total points
ID: 7043046
Wish I had time and expertise to write the full answer for you. Right now the best I can do is point you at this IBM Redbook:
    http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg245485.pdf

DB2 has historically supported stored procedures as native language methods that are executed by the database engine. The SQL Procedures language described by the Redbook is more traditionally like PL/SQL. As such, it may not be that difficult to syntactically convert the PL/SQL.

One hurdle you may have to overcome is that it appears you are using PL/SQL directly from your Java program. I don't know that DB2 would really support this in any form. I think you would have to write a stored procedure and install it on the database -- not assemble it dynamically in your application as you appear to be doing.

Barring that, it seems that it would be necessary to convert this to Java code which uses an outer SELECT statement and an inner INSERT statement to do the same thing.

Jim
0
 
LVL 35

Expert Comment

by:girionis
ID: 8813173
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to jim_cakalic@idg

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0
 
LVL 19

Expert Comment

by:Jim Cakalic
ID: 8813741
OK. Thanks. :-)
Jim
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question