Skip to main content

I am trying to use a cursor to read a stored procedure, but get "parse error at :ret-code" on the following declare:

EXEC SQL
DECLARE FpReportIdCursor CURSOR FOR
:ret-code = exec
CBM.dbo.FileProcessingReportDetail_SelectByReportID
(:ws-report-id)
END-EXEC

I assume I am missing something on the exec line but the syntax above is just like the example in the manual.
I use cursors in AcuSQL to read tables with no problem but this is my first attempt at a stored procedure.

The manuals example gets the same parse error when I try to compile it.

There are several similar questions on this forum but no answers.

Any help would be appreciated.

Thanks,
Steve

I am trying to use a cursor to read a stored procedure, but get "parse error at :ret-code" on the following declare:

EXEC SQL
DECLARE FpReportIdCursor CURSOR FOR
:ret-code = exec
CBM.dbo.FileProcessingReportDetail_SelectByReportID
(:ws-report-id)
END-EXEC

I assume I am missing something on the exec line but the syntax above is just like the example in the manual.
I use cursors in AcuSQL to read tables with no problem but this is my first attempt at a stored procedure.

The manuals example gets the same parse error when I try to compile it.

There are several similar questions on this forum but no answers.

Any help would be appreciated.

Thanks,
Steve

Are you using the -Ps compile option? What other pre-compiler options are you using?


I am trying to use a cursor to read a stored procedure, but get "parse error at :ret-code" on the following declare:

EXEC SQL
DECLARE FpReportIdCursor CURSOR FOR
:ret-code = exec
CBM.dbo.FileProcessingReportDetail_SelectByReportID
(:ws-report-id)
END-EXEC

I assume I am missing something on the exec line but the syntax above is just like the example in the manual.
I use cursors in AcuSQL to read tables with no problem but this is my first attempt at a stored procedure.

The manuals example gets the same parse error when I try to compile it.

There are several similar questions on this forum but no answers.

Any help would be appreciated.

Thanks,
Steve

Yes. My compile line is:

ccbl32.exe -o H:\\cbl740\\%r -Ps -Pk mssql -cr -DS -za -lfo list.sbe --nodata32bit %r%e


I am trying to use a cursor to read a stored procedure, but get "parse error at :ret-code" on the following declare:

EXEC SQL
DECLARE FpReportIdCursor CURSOR FOR
:ret-code = exec
CBM.dbo.FileProcessingReportDetail_SelectByReportID
(:ws-report-id)
END-EXEC

I assume I am missing something on the exec line but the syntax above is just like the example in the manual.
I use cursors in AcuSQL to read tables with no problem but this is my first attempt at a stored procedure.

The manuals example gets the same parse error when I try to compile it.

There are several similar questions on this forum but no answers.

Any help would be appreciated.

Thanks,
Steve

Using the example in the docs:

EXEC SQL declare spcursor cursor for

          :ret-code = exec sp_listcustomer (:c-last-name,

           :num-rows out)

          END-EXEC.

I was able to compile using -Ps and -Pk


I am trying to use a cursor to read a stored procedure, but get "parse error at :ret-code" on the following declare:

EXEC SQL
DECLARE FpReportIdCursor CURSOR FOR
:ret-code = exec
CBM.dbo.FileProcessingReportDetail_SelectByReportID
(:ws-report-id)
END-EXEC

I assume I am missing something on the exec line but the syntax above is just like the example in the manual.
I use cursors in AcuSQL to read tables with no problem but this is my first attempt at a stored procedure.

The manuals example gets the same parse error when I try to compile it.

There are several similar questions on this forum but no answers.

Any help would be appreciated.

Thanks,
Steve

I'm certainly not an expert .. I believe the CBM.dbo.FileProcessingReportDetail_SelectByReportID  is the issue, when I reduced this to FileProcessingReportDetail_SelectByReportID it compiled for me


I am trying to use a cursor to read a stored procedure, but get "parse error at :ret-code" on the following declare:

EXEC SQL
DECLARE FpReportIdCursor CURSOR FOR
:ret-code = exec
CBM.dbo.FileProcessingReportDetail_SelectByReportID
(:ws-report-id)
END-EXEC

I assume I am missing something on the exec line but the syntax above is just like the example in the manual.
I use cursors in AcuSQL to read tables with no problem but this is my first attempt at a stored procedure.

The manuals example gets the same parse error when I try to compile it.

There are several similar questions on this forum but no answers.

Any help would be appreciated.

Thanks,
Steve

I am still trying to get the example in the docs to compile.

Also, I don't really think it is the CBM.dbo that is the problem because the following compiles and runs just fine:

          EXEC SQL

             DECLARE VendorReportCursor CURSOR

             FOR

             SELECT *

             FROM CBM.dbo.Reports_Products

             WHERE VendorCode = :ws-vendor

          END-EXEC

I am reading through the docs again to see if there is something I am missing.

Are you using any sql related environment variables?


I am trying to use a cursor to read a stored procedure, but get "parse error at :ret-code" on the following declare:

EXEC SQL
DECLARE FpReportIdCursor CURSOR FOR
:ret-code = exec
CBM.dbo.FileProcessingReportDetail_SelectByReportID
(:ws-report-id)
END-EXEC

I assume I am missing something on the exec line but the syntax above is just like the example in the manual.
I use cursors in AcuSQL to read tables with no problem but this is my first attempt at a stored procedure.

The manuals example gets the same parse error when I try to compile it.

There are several similar questions on this forum but no answers.

Any help would be appreciated.

Thanks,
Steve

I am still trying to get the example in the docs to compile.

Also, I don't really think it is the CBM.dbo that is the problem because the following compiles and runs just fine:

          EXEC SQL

             DECLARE VendorReportCursor CURSOR

             FOR

             SELECT *

             FROM CBM.dbo.Reports_Products

             WHERE VendorCode = :ws-vendor

          END-EXEC

I am reading through the docs again to see if there is something I am missing.

Are you using any sql related environment variables?


I am trying to use a cursor to read a stored procedure, but get "parse error at :ret-code" on the following declare:

EXEC SQL
DECLARE FpReportIdCursor CURSOR FOR
:ret-code = exec
CBM.dbo.FileProcessingReportDetail_SelectByReportID
(:ws-report-id)
END-EXEC

I assume I am missing something on the exec line but the syntax above is just like the example in the manual.
I use cursors in AcuSQL to read tables with no problem but this is my first attempt at a stored procedure.

The manuals example gets the same parse error when I try to compile it.

There are several similar questions on this forum but no answers.

Any help would be appreciated.

Thanks,
Steve

It looks like it is an issue with the 7.2.1 compiler.

When I started using 9.1.2 it complies.

Also, as you mentioned it does not like CBM.dbo in the cursor for exec but does not mind it in the cursor for select.