471,579 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,579 software developers and data experts.

DB2 Development Center: Java stored procedure question ....

Have a question on the Stored procedure method code generated by DB2
development center for Java stored procedures.

Suppose I have a requirement to return the resultset consisting of
FIRSTNME, LASTNAME of all employees belonging to a particular
department, following is the stored procedure method code generated by
"DB2 development center":

public static void sproc3mtd ( String workdept,
String[] firstnme,
String[] lastname,
String[] errorlabel,
ResultSet[] rs1 ) throws Exception

In reality, only the following method would have sufficed:

public static void sproc3mtd ( String workdept,
String[] errorlabel,
ResultSet[] rs1 ) throws Exception

This is because FIRSTNME and LASTNAME are generated in the resultset
itself and so, no explicity declaration for them needs to be done in
the stored procedure method.

Does anyone know why DB2 development center generates this redundant
code?

Thanks.
Raquel.
Nov 12 '05 #1
1 2388

"Raquel" <ra****************@yahoo.com> wrote in message
news:9a**************************@posting.google.c om...
Have a question on the Stored procedure method code generated by DB2
development center for Java stored procedures.

Suppose I have a requirement to return the resultset consisting of
FIRSTNME, LASTNAME of all employees belonging to a particular
department, following is the stored procedure method code generated by
"DB2 development center":

public static void sproc3mtd ( String workdept,
String[] firstnme,
String[] lastname,
String[] errorlabel,
ResultSet[] rs1 ) throws Exception

In reality, only the following method would have sufficed:

public static void sproc3mtd ( String workdept,
String[] errorlabel,
ResultSet[] rs1 ) throws Exception

This is because FIRSTNME and LASTNAME are generated in the resultset
itself and so, no explicity declaration for them needs to be done in
the stored procedure method.

Does anyone know why DB2 development center generates this redundant
code?

I haven't used the Development Center yet so this is just a guess; however,
assuming that the Development Center is similar to the Stored Procedure
Builder in earlier versions of DB2, it is probably because you've specified
firstname and lastname in the query that you entered in the wizard. You can
prove this by creating a few more simple stored procedures and see if every
column specified in the query that is specified in the wizard appears in the
parameter list for your method.

If I'm right, you can prevent the unwanted column names from being generated
in the parameter list by revising the query so that firstnme and lastname
columns are not mentioned in the query. I don't know if that's possible in
your particular case; if it isn't possible, you should be able to delete the
extra column names from the parameter list manually after the stored
procedure is generated. I do major edits of the stored procedure code all
the time in the Stored Procedure Builder without problems: if you change the
parameters, the Builder will ask whether you want to replace the original
version of the procedure or create a new one; you just click the appropriate
button and the Builder does the rest.

Rhino
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by M.sajjad | last post: by
2 posts views Thread by Anthony Robinson | last post: by
2 posts views Thread by hubert_s | last post: by
1 post views Thread by Henry Reardon | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.