Solved

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

Posted on 2002-05-29
4
223 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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:

896 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now