Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Created DB2 proc. I cannot see the problem with this

Status
Not open for further replies.

thendrickson

Programmer
Apr 14, 2004
226
US
I have little experience with db2 and am trying to create a new procedure by following the example and modifying it to fit my needs I found on IBM's web site
I cannnot see the problem with this
The first error shows at "Begin" and I have noted the errors shown with the addition of the comment symbols if you want to paste this into an editor.
I have examined this and compared it to everything I have found so far and do not see my error so I would appreciate any body who can point out my error
Thanks

CREATE PROCEDURE RPT.rpt_CR_NCS0436B ()DYNAMIC RESULT SETS 1


P1: BEGIN --error shows as; DB2 for Linux, UNIX, and Windows: "END" was expected to form a complete scope.

DECLARE cursor1 CURSOR WITH RETURN for --DB2 for Linux, UNIX, and Windows: "<psm_semicolon>" was expected to form a complete scope.



-- #######################################################################

-- ######################################################################
SELECT
CALLMST.CACMPNY,
CLMDTL.CDCMPNY,
CLMEXCLDTL.CECLMDT
FROM TESTSCHEMA.CALLMST CALLMST
INNER JOIN TESTSCHEMA.CLMDTL CLMDTL
ON CALLMST.CACMPNY=CLMDTL.CDCMPNY
AND CALLMST.CADIV=CLMDTL.CDDIV
INNER JOIN TESTSCHEMA.CLMEXCLDTL CLMEXCLDTL
ON CLMDTL.CDCLMDT=CLMEXCLDTL.CECLMDT
AND CLMDTL.CDCLMSEQ=CLMEXCLDTL.CECLMSEQ
AND CLMDTL.CDCLMSFX=CLMEXCLDTL.CECLMSFX
AND CLMDTL.CDSRVLN=CLMEXCLDTL.CESRVLN;

-- Cursor left open for client application
OPEN cursor1; --DB2 for Linux, UNIX, and Windows: "<join_type_without_spec> JOIN <join_operand>" was expected to form a complete scope.
END P1 -- Multiple markers at this line
- DB2 for Linux, UNIX, and Windows: "JOIN <joined_table>" was expected to form a complete scope.
- DB2 for Linux, UNIX, and Windows: "<join_spec>" was expected after "P1".

I also tried it with the statement terminator added to the last line END P1; which generated -- DB2 for Linux, UNIX, and Windows: "<join_type_without_spec> JOIN <join_operand>" was expected to form a complete scope. as the last error leaving the previous errors the same


 
After additional reading, I was able to determine my problem which was not related to syntax but instead to not having studied db2 enough to understand differences with SQL Server and/or Oeacle on creating procedures
 
Thank you for posting what you found.

Do be aware that neither SQL Server nor Oracle are DB2.
 
Papadba,
I found that out I must admit. I underestimated the challenge and over estimated my knowledge a bit [bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top