467,189 Members | 1,237 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,189 developers. It's quick & easy.

FOR READ ONLY cursor a named statement

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
  • viewed: 3102
Share:
2 Replies
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
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.

Similar topics

reply views Thread by Prashanth | last post: by
1 post views Thread by Zri Man | last post: by
6 posts views Thread by Samuel M. Smith | last post: by
2 posts views Thread by nekiv90@hotmail.com | last post: by
3 posts views Thread by Rahul Babbar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.