On 04-Jun-2015 13:07 -0600, Hoteltravelfundotcom wrote:
OK now trying SP but getting error, what is the syntax I am off?

CREATE PROCEDURE rlib.spclspaytp()
BEGIN
DECLARE CURSOR_ CURSOR WITH RETURN FOR
SELECT * FROM ASTDTA.REFERRF;
OPEN CURSOR_;
END


SQL0104 - Token <END-OF-STATEMENT> was not valid. Valid tokens: ;.

SQL0084 - SQL statement not allowed.
SQL0104 - Token <END-OF-STATEMENT> was not valid.
Valid tokens: DECLARE.

The syntax is documented in the InfoCenter for CREATE PROCEDURE, SQL-procedure-statement, SQL-control-statement, and Compound-Statement, plus the web has a plethora of examples for DB2; even if not DB2 for IBM i SQL examples, the DB2 variants are syntactically quite near identical with respect to declarative and control statements.

Here is an example [as scripted SQL that can be input to the Run SQL Statements (RUNSQLSTM) command] that includes a CREATE PROCEDURE that may assist:

<http://archive.midrange.com/web400/201405/msg00007.html>
"drop procedure myRSproc
; -- delete prior routine which is a SQL 'stored procedure'
create procedure myRSproc
..."


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.