473,659 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1674


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.SQLExc eption: [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.executeUp date("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:
informatio n 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
4650
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 not obvious how the code works if you don't know the intricacies of the Property Let/Get syntax. Likewise, I dislike (and code to minimize the use of) the VB/VBA syntax of returning a value by referring to the function name as if it were a...
12
10392
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 @salesdate as varchar(20),
3
1571
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 name and address fields in a datatable called customers based on the input value customer ID = ( datatable/Customers)customerID I have got this far and then got lost: Create SP_UpdateCustomer
2
1074
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/ Address1) from a databletable called "Customer" and insert both of these into a datatable called "Orders"
4
6705
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 DB Provider for SQL Server SQLState: 42000
14
5897
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
3620
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 '--------------------------------------------------------------------------­-------------------------------- Before - This Works without a paramater '--------------------------------------------------------------------------­--------------------------------
6
7276
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 (confirmation) declared in page. Dim RsSp , SQLSp Set RsSp = Server.CreateObject("ADODB.Recordset") SQLSp = "Declare @confirm varchar(1)" SQLSp = SQLSp & "Exec SendMsg_proc "& "'" & UniCode &"' , '" & DintUserId &"' , '" & DintOrg_id &"' ,...
2
2817
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 the role 'db_generaluser' to the user created in step 2. The login name and password for the login to be created will be supplied from externally through input parameters. If this procedure executes successfully it returns 0 else 1 to the caller...
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8332
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.