RE: Creating Stored procedure in DB2 using SQL

RE: Creating Stored procedure in DB2 using SQL

 

  

Muthukumar,

You have to declare a cursor and then fetch from the cusrsor. What you have
done is not allowed.

Pls. refer chapter on stored procedures in DB2 Application Programming Guide


Regards

-----Original Message-----
From: [Email Address Removed] [mailto:[Email Address Removed] 14 November 2003 06:53
To: [Email Address Removed] Creating Stored procedure in DB2 using SQL


Hi All,

I face an error while creating a stored procedure in DB2 using SQl.

CREATE PROCEDURE MUTHUKUMARA.Proc1 ( )
LANGUAGE SQL
------------------------------------------------------------------------
-- SQL Stored Procedure
------------------------------------------------------------------------
P1: BEGIN
select * from account;
END P1

The error is
============
MUTHUKUMARA.PROC1 - Create stored procedure returns -104.

MUTHUKUMARA.PROC1: 7: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected
token "select *" was found following "--------- P1: BEGIN ". Expected
tokens may include: "<delete>". LINE NUMBER=7. SQLSTATE=42601



MUTHUKUMARA.PROC1 - Changes rolled back.

MUTHUKUMARA.PROC1 - Build failed.

Please Help me.

Muthukumar.A


---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: db2udbdba-[Email Address Removed] additional commands, e-mail: db2udbdba-[Email Address Removed] email and any files transmitted with it are confidential and are
intended solely for the use of the individual or entity to whom they are
addressed. This communication represents the originator's personal views and
opinions, which do not necessarily reflect those of HPI Limited. If you are
not the original recipient or the person responsible for delivering the
email to the intended recipient, be advised that you have received this
email in error, and that any use, dissemination, forwarding, printing, or
copying of this email is strictly prohibited. If you received this email in
error, please immediately notify [Email Address Removed] message has been scanned by Panda Anti-Virus. Recipients are advised to
apply their own virus checks to this message on delivery.
**********************************************************************


DB2 & UDB email list listserv db2-l LazyDBA home page