Solved

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

Posted on 2002-05-29
4
226 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
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Jim Cakalic earned 500 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

829 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