By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,227 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,227 IT Pros & Developers. It's quick & easy.

FOR READ ONLY cursor a named statement

P: n/a
Can you not use the 'FOR READ ONLY' option with the cursor declare
unless you put the SELECT statement in the declare?

re:

EXEC SQL
DECLARE c2 CURSOR FOR s2 FOR READ ONLY;

errors with:

------ ------------------------------------------------------------
SQL0060W The "C" precompiler is in progress.
214 SQL0104N An unexpected token "FOR" was found following
"<identifier>". Expected tokens may include:
"END-OF-STATEMENT".
267 SQL4946N The cursor or statement name "C2" is not defined.
307 SQL4946N The cursor or statement name "C2" is not defined.
414 SQL4946N The cursor or statement name "C2" is not defined.

or do I just have the syntax wrong. I didnt find any examples that
uses statement names instead of a select statement.

Apr 22 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I think you should specify FOR READ ONLY in the statement s2.
According to syntax diagram, FOR READ ONLY is not part of DECLARE
CURSOR.
It is a part of select-statement.
Here are simplified syntax diagrams.
--DECLARE---cursor-name---CURSOR---FOR---select-statement---<< or--DECLARE---cursor-name---CURSOR---FOR---statement-name---<<


Apr 22 '06 #2

P: n/a
Thanks for the reply....that same thing popped in my head at about 3
a.m. I was associatng the FOR READ ONLY with the DECLARE cursor and
not in the SELECT so I will give it a try.

Thanks!

Apr 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.