473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

ignorant DB2 dilletante question: what's the syntax for a procedure...


Hi all. Sorry for the basic question... What's the syntax for creating a procedure
which simply returns a cursor for "select * from foo"? I am completely illiterate
about DB2, and I'm just reproducing a JDBC problem for a customer. thanks in advance,
Joe Weinstein at BEA

Nov 12 '05 #1
7 1664


Joe Weinstein wrote:

Hi all. Sorry for the basic question... What's the syntax for creating a
procedure
which simply returns a cursor for "select * from foo"? I am completely
illiterate
about DB2, and I'm just reproducing a JDBC problem for a customer.
thanks in advance,
Joe Weinstein at BEA


found it:

String proc = "CREATE PROCEDURE FOO_SELECT ( ) "
+ " LANGUAGE SQL "
+ " RESULT SETS 1 "
+ " BEGIN "
+ " DECLARE C1 CURSOR WITH RETURN FOR "
+ " SELECT JOETEST.FOO, JOETEST.BAR "
+ " from JOETEST "
+ " ORDER BY JOETEST.BAR, JOETEST.FOO; "
+ " OPEN C1; "
+ " END ";

Nov 12 '05 #2
Joe Weinstein wrote:

Hi all. Sorry for the basic question... What's the syntax for creating a
procedure which simply returns a cursor for "select * from foo"? I am
completely illiterate about DB2, and I'm just reproducing a JDBC problem
for a customer. thanks in advance, Joe Weinstein at BEA


Have a look here:

http://publib.boulder.ibm.com/infoce...help/index.jsp

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #3
> > Hi all. Sorry for the basic question... What's the syntax for creating a
procedure which simply returns a cursor for "select * from foo"? I am
completely illiterate about DB2, and I'm just reproducing a JDBC problem
for a customer. thanks in advance, Joe Weinstein at BEA


Have a look here:

http://publib.boulder.ibm.com/infoce...help/index.jsp

--
Knut Stolze


I believe he answered his own question in a subsequent post a long time ago.
You should have known that.
Nov 12 '05 #4
Mark A wrote:
> Hi all. Sorry for the basic question... What's the syntax for creating
> a procedure which simply returns a cursor for "select * from foo"? I am
> completely illiterate about DB2, and I'm just reproducing a JDBC
> problem for a customer. thanks in advance, Joe Weinstein at BEA


Have a look here:

http://publib.boulder.ibm.com/infoce...help/index.jsp

--
Knut Stolze


I believe he answered his own question in a subsequent post a long time
ago. You should have known that.


Yes, I saw that. However, I just got an email from him sayingthat the link
to the DB2 documentation was something he did not yet have. Sometimes it
can't hurt to provide some basic information too. ;-)

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #5


Knut Stolze wrote:
Joe Weinstein wrote:

Hi all. Sorry for the basic question... What's the syntax for creating a
procedure which simply returns a cursor for "select * from foo"? I am
completely illiterate about DB2, and I'm just reproducing a JDBC problem
for a customer. thanks in advance, Joe Weinstein at BEA

Have a look here:

http://publib.boulder.ibm.com/infoce...help/index.jsp


Thanks Knut! I *think* I have the syntax, but you could probably tell
I had no resources so your link will help!
My puzzle is that I believe my syntax is correct, and a program
using it was successful for a while and then without change on the
client it started failing, saying:

java.sql.SQLException: [BEA][DB2 JDBC Driver][DB2]The SQL procedure
FOO_SELECT was not created because of a compile error. Detailed
information can be found in the error log file P6352915.log.

There is no such log file on the client, and I'd like to know where
to tell the DBA where to look for it on the DBMS machine...
The Java code was:

String proc = "CREATE PROCEDURE FOO_SELECT ( ) "
+ " LANGUAGE SQL "
+ " RESULT SETS 1 "
+ " BEGIN "
+ " DECLARE C1 CURSOR WITH RETURN FOR "
+ " SELECT JOETEST.FOO, JOETEST.BAR "
+ " from JOETEST "
+ " ORDER BY JOETEST.BAR, JOETEST.FOO; "
+ " OPEN C1; "
+ " END ";

try{s.executeUpdate("DROP PROCEDURE FOO_SELECT");} catch (Exception ignore){}
s.executeUpdate(proc);

Assume a table, JOETEST( FOO INT, BAR INT )...

thanks in advance for any extra help,
Joe Weinstein at BEA

Nov 12 '05 #6
>>information can be found in the error log file P6352915.log.
There is no such log file on the client, and I'd like to know where
to tell the DBA where to look for it on the DBMS machine...


Hi Joe;
This log will be found in (or near) the server libraries that manage
routines, usually like $DB2HOME/sqllib/function/routine/sqlproc/$USER
where $DB2HOME is the root dir for DB2 and $USER is the userid that was
trying to create the proc.

HTH

Pete H

Nov 12 '05 #7


peteh wrote:
information can be found in the error log file P6352915.log.
There is no such log file on the client, and I'd like to know where
to tell the DBA where to look for it on the DBMS machine...

Hi Joe;
This log will be found in (or near) the server libraries that manage
routines, usually like $DB2HOME/sqllib/function/routine/sqlproc/$USER
where $DB2HOME is the root dir for DB2 and $USER is the userid that was
trying to create the proc.

HTH

Pete H


Thank you very much for your assistance.

Joe Weinstein at BEA

Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

55
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's...
12
by: Bill Nguyen | last post by:
What's the VB syntax to run the CR report using the following SP? I use CrystalreportViewer and ReportDocument. Thanks Bill Here's the SP in SQLserver 2K: CREATE proc mysp_ReportSubmission...
3
by: martinharvey | last post by:
This is probably a very simple question but i would appreciate some help with the correct syntax for and update stored procedure I have created a user form that allows the user to update the...
2
by: martinharvey via DotNetMonster.com | last post by:
This is probably a very simple question but i am having problems with a stored procedure syntax. I want to insert fields with preset values (DateCreated/OrderVerified) and two values (Name/...
4
by: Jack | last post by:
Hi, I am trying to run an example code from a book. However I am getting the following error message: Number: -2147217900 Description: Syntax error or access violation Source: Microsoft OLE...
14
by: dba_222 | last post by:
Dear experts, Again, sorry to bother you again with such a seemingly dumb question, but I'm having some really mysterious results here. ie. Create procedure the_test As
5
by: Dennis | last post by:
Hi I'm trying to alter my stored procedure to take a parameter for the Database Name, but as usual the syntax is killing me. Thanks for any help Dennis ...
6
Soniad
by: Soniad | last post by:
Hello, I am excecuting a stored procedure in my ASP page , it has one out parameter (@confirm) . after executing the procedure i want to retreive this out parameter and assign it to variable...
2
by: priyamtheone | last post by:
I'm trying to create a stored procedure in MSSQL Server 2005 that'll perform the following jobs: 1) Create a login. 2) Create an user in TestDB database for the login created in step 1. 3) Assign...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.