473,471 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

db2 procedure in solaris

Here are two simple stored procedures which were there in a database
on a SOLARIS machine, one with an input parameter and the other with
no parameter. From a Linux DB2 client command prompt, the call to
stored procedure with no parameter works fine where as the call to the
procedure with the input parameter does not work. can any onehelp me
on this.

Procedure 1 with a parameter:

CREATE PROCEDURE DMSODS.test_proc (IN n INT)
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1

Procedure 2 with no parameter:

CREATE PROCEDURE DMSODS.test_proc1 ()
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1

Call from Linux:
db2 "call test_proc(1)"
SQL0104N An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: "<space>". SQLSTATE=42601

db2 "call test_proc1()"

Return Status = 0
Thanks,
Kamalnath.V
Aug 12 '08 #1
7 1623
Gladiator wrote:
Here are two simple stored procedures which were there in a database
on a SOLARIS machine, one with an input parameter and the other with
no parameter. From a Linux DB2 client command prompt, the call to
stored procedure with no parameter works fine where as the call to the
procedure with the input parameter does not work. can any onehelp me
on this.

Procedure 1 with a parameter:

CREATE PROCEDURE DMSODS.test_proc (IN n INT)
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1

Procedure 2 with no parameter:

CREATE PROCEDURE DMSODS.test_proc1 ()
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1

Call from Linux:
db2 "call test_proc(1)"
SQL0104N An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: "<space>". SQLSTATE=42601

db2 "call test_proc1()"

Return Status = 0
Smells like a linux shell problem.
What happens if you type:
db2
call test_proc(1)
quit

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Aug 12 '08 #2
On Aug 12, 3:43*pm, Serge Rielau <srie...@ca.ibm.comwrote:
Gladiator wrote:
Here are two simple stored procedures which were there in a database
on a SOLARIS machine, one with an input parameter and the other with
no parameter. From a Linux DB2 client command prompt, the call to
stored procedure with no parameter works fine where as the call to the
procedure with the input parameter does not work. *can any onehelp me
on this.
Procedure 1 with a parameter:
CREATE PROCEDURE DMSODS.test_proc (IN n INT)
* * LANGUAGE SQL
P1: * BEGIN
* * * DECLARE SQLSTATE CHAR(5);
END P1
Procedure 2 with no parameter:
CREATE PROCEDURE DMSODS.test_proc1 ()
* * LANGUAGE SQL
P1: * BEGIN
* * * DECLARE SQLSTATE CHAR(5);
END P1
Call from Linux:
db2 "call test_proc(1)"
SQL0104N *An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: *"<space>". *SQLSTATE=42601
*db2 "call test_proc1()"
* Return Status = 0

Smells like a linux shell problem.
What happens if you type:
db2
call test_proc(1)
quit

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab- Hide quoted text -

- Show quoted text -
Does it make some difference if we execute a procedure from a 32-bit
instance client which is accesing the procedure/database on a 64-bit
instance ?

thanks,
kamal.
Aug 12 '08 #3
Gladiator wrote:
On Aug 12, 3:43 pm, Serge Rielau <srie...@ca.ibm.comwrote:
>Gladiator wrote:
>>Here are two simple stored procedures which were there in a database
on a SOLARIS machine, one with an input parameter and the other with
no parameter. From a Linux DB2 client command prompt, the call to
stored procedure with no parameter works fine where as the call to the
procedure with the input parameter does not work. can any onehelp me
on this.
Procedure 1 with a parameter:
CREATE PROCEDURE DMSODS.test_proc (IN n INT)
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1
Procedure 2 with no parameter:
CREATE PROCEDURE DMSODS.test_proc1 ()
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1
Call from Linux:
db2 "call test_proc(1)"
SQL0104N An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: "<space>". SQLSTATE=42601
db2 "call test_proc1()"
Return Status = 0
Smells like a linux shell problem.
What happens if you type:
db2
call test_proc(1)
quit
Does it make some difference if we execute a procedure from a 32-bit
instance client which is accesing the procedure/database on a 64-bit
instance ?
No, I'm 99.9% certain that this is not a DB2 problem.
It seems like the linux shell you are using is doing something to the
text in the double quotes.
Please try what i proposed it will rule out any issues along the 32/64
bit boundary, OS differences and server issues.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Aug 12 '08 #4
On Aug 12, 5:41*pm, Serge Rielau <srie...@ca.ibm.comwrote:
Gladiator wrote:
On Aug 12, 3:43 pm, Serge Rielau <srie...@ca.ibm.comwrote:
Gladiator wrote:
Here are two simple stored procedures which were there in a database
on a SOLARIS machine, one with an input parameter and the other with
no parameter. From a Linux DB2 client command prompt, the call to
stored procedure with no parameter works fine where as the call to the
procedure with the input parameter does not work. *can any onehelp me
on this.
Procedure 1 with a parameter:
CREATE PROCEDURE DMSODS.test_proc (IN n INT)
* * LANGUAGE SQL
P1: * BEGIN
* * * DECLARE SQLSTATE CHAR(5);
END P1
Procedure 2 with no parameter:
CREATE PROCEDURE DMSODS.test_proc1 ()
* * LANGUAGE SQL
P1: * BEGIN
* * * DECLARE SQLSTATE CHAR(5);
END P1
Call from Linux:
db2 "call test_proc(1)"
SQL0104N *An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: *"<space>". *SQLSTATE=42601
*db2 "call test_proc1()"
* Return Status = 0
Smells like a linux shell problem.
What happens if you type:
db2
call test_proc(1)
quit
Does it make some difference if we execute a procedure from a 32-bit
instance client which is accesing the procedure/database on a 64-bit
instance ?

No, I'm 99.9% certain that this is not a DB2 problem.
It seems like the linux shell you are using is doing something to the
text in the double quotes.
Please try what i proposed it will rule out any issues along the 32/64
bit boundary, OS differences and server issues.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab- Hide quoted text -

- Show quoted text -
Hi serge ,

it gives me the same result

db2 =call test_proc(1)
SQL0104N An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: "<space>". SQLSTATE=42601
Thanks ,
Kamal.
Aug 12 '08 #5
On Aug 12, 7:16*pm, Gladiator <vkamalnath1...@gmail.comwrote:
On Aug 12, 5:41*pm, Serge Rielau <srie...@ca.ibm.comwrote:


Gladiator wrote:
On Aug 12, 3:43 pm, Serge Rielau <srie...@ca.ibm.comwrote:
>Gladiator wrote:
>>Here are two simple stored procedures which were there in a database
>>on a SOLARIS machine, one with an input parameter and the other with
>>no parameter. From a Linux DB2 client command prompt, the call to
>>stored procedure with no parameter works fine where as the call to the
>>procedure with the input parameter does not work. *can any onehelp me
>>on this.
>>Procedure 1 with a parameter:
>>CREATE PROCEDURE DMSODS.test_proc (IN n INT)
>>* * LANGUAGE SQL
>>P1: * BEGIN
>>* * * DECLARE SQLSTATE CHAR(5);
>>END P1
>>Procedure 2 with no parameter:
>>CREATE PROCEDURE DMSODS.test_proc1 ()
>>* * LANGUAGE SQL
>>P1: * BEGIN
>>* * * DECLARE SQLSTATE CHAR(5);
>>END P1
>>Call from Linux:
>>db2 "call test_proc(1)"
>>SQL0104N *An unexpected token ")" was found following "BEGIN-OF-
>>STATEMENT".
>>Expected tokens may include: *"<space>". *SQLSTATE=42601
>>*db2 "call test_proc1()"
>>* Return Status = 0
>Smells like a linux shell problem.
>What happens if you type:
>db2
>call test_proc(1)
>quit
Does it make some difference if we execute a procedure from a 32-bit
instance client which is accesing the procedure/database on a 64-bit
instance ?
No, I'm 99.9% certain that this is not a DB2 problem.
It seems like the linux shell you are using is doing something to the
text in the double quotes.
Please try what i proposed it will rule out any issues along the 32/64
bit boundary, OS differences and server issues.
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab- Hide quoted text -
- Show quoted text -

Hi serge ,

it gives me the same result

db2 =call test_proc(1)
SQL0104N *An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: *"<space>". *SQLSTATE=42601

Thanks ,
Kamal.- Hide quoted text -

- Show quoted text -
one more thing i found was. i tried the same command on 2 different
linux clients which has V9.5 fix pack 0 . It was failing on both the
machines. It seems to be executing fine on any other client version of
DB2 .

One more query i have is... If i have a client installed on a machine
how do i find which client it is ( Runtime client, admin Client or
Application development client).

Thanks ,
Kamal.
Aug 12 '08 #6
Gladiator wrote:
>db2 =call test_proc(1)
SQL0104N An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: "<space>". SQLSTATE=42601
OK.. now that is getting my attention. I admit to being stumped...
Just for paranoias sake try these:
db2 =call test_proc(a)
SQL0206N "A" is not valid in the context where it is used. SQLSTATE=42703
db2 =values 1

1
-----------
1

1 record(s) selected.

What do you get?
(I'm trying to figure out whether something with your terminator is broken)

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Aug 12 '08 #7
Gladiator wrote:
Here are two simple stored procedures which were there in a database
on a SOLARIS machine, one with an input parameter and the other with
no parameter. From a Linux DB2 client command prompt, the call to
stored procedure with no parameter works fine where as the call to the
procedure with the input parameter does not work. can any onehelp me
on this.

Procedure 1 with a parameter:

CREATE PROCEDURE DMSODS.test_proc (IN n INT)
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1

Procedure 2 with no parameter:

CREATE PROCEDURE DMSODS.test_proc1 ()
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1

Call from Linux:
db2 "call test_proc(1)"
SQL0104N An unexpected token ")" was found following "BEGIN-OF-
STATEMENT".
Expected tokens may include: "<space>". SQLSTATE=42601

db2 "call test_proc1()"

Return Status = 0
Thanks,
Kamalnath.V
Quick test on Linux (Red Hat 5.1) shows that:

[db2iv952@riscjmn ~]$ db2 -td@ -vf test.db2
CREATE PROCEDURE DMSODS.test_proc (IN n INT)
LANGUAGE SQL
P1: BEGIN
DECLARE SQLSTATE CHAR(5);
END P1
DB20000I The SQL command completed successfully.

[db2iv952@riscjmn ~]$ db2 call "dmsods.test_proc(1)"

Return Status = 0

so it is working.
My environment is:

[db2iv952@riscjmn ~]$ bash --version
GNU bash, version 3.1.17(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
[db2iv952@riscjmn ~]$ uname -a
Linux riscjmn.torolab.ibm.com 2.6.18-53.el5xen #1 SMP Wed Oct 10
16:48:44 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
This is where my DB2 is newer than yours:

[db2iv952@riscjmn ~]$ db2level
DB21085I Instance "db2iv952" uses "64" bits and DB2 code release
"SQL09052" with level identifier "03030107".
Informational tokens are "DB2 v9.5.0.2", "s080623", "MI00239", and Fix
Pack "2".
Product is installed at "/opt/ibm/db2/V9.5".
I will check tomorrow whether DB2 V9.5 GA has the problem you are
describing.

Jan M. Nelken
Aug 13 '08 #8

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

Similar topics

1
by: Raquel | last post by:
This is a stored procedure that resides on Mainframe and gets executed on the client by connecting to the mainframe through DB2 connect. It was executing fine till yesterday when I executed a table...
1
by: _link98 | last post by:
On Linux or Solaris with UDB 8.2.2, can an SQL/PL stored-procedure use two-phase-commit with nicknames and if DB2 provides the Transaction-manager? i.e. in the same transaction, can an SQL/PL...
4
by: _link98 | last post by:
Problem: java ResultSet cursor from SQL/PL stored-procedure is FORWARD_ONLY. Is it possible to have ResultSet cursors from SQL/PL procedures to scroll forward and backwards? Perhaps I am missing...
4
by: hicks | last post by:
I'm trying to invoke a DB2 stored procedure. The stored proc is coded in C and compiled to a shared library, which has been placed in the <DB2 dir>/functions directory. The platform is Solaris....
13
by: Mary Lei | last post by:
Does anyone know the link to obtain the tarball for db2 8.1 for solaris running on AMD 64 bit ? This is the entire db2 installation on a new system that does not have db2. Thanks.
0
by: %NAME% | last post by:
Hi, I am trying to create stored procedure in DB2. I am using version v7.1.0.40, on Solaris. The procedure is written in SQL PL and is very simple. However, I could not build it. I got...
3
by: andrewkl | last post by:
hi, I have the following Perl code that inserts a string to an Oracle DB via a stored procedure: #!/usr/local/bin/perl ## Perl v5.8.6 built for sun4-solaris use strict; BEGIN...
0
by: mg | last post by:
When make gets to the _ctypes section, I am getting the following in my output: building '_ctypes' extension creating build/temp.solaris-2.10-i86pc-2.5/home/ecuser/Python-2.5.1/ Modules/_ctypes...
1
by: rajpar | last post by:
Environment: Solaris (client + server) db2 version 7.2 latest fixpak (DB2 v7.1.0.111", "s050516" and "U803330") Compiler: gcc Here is my SP code executed on the client: CREATE PROCEDURE...
0
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,...
0
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...
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...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.