×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Now, unless there's more to this statement than you've shown
us, there's no need to use dynamic SQL. A static statement would work:

someDateFieldCHAR = %char(someDateField);

Exec SQL
Declare C2 cursor for
Select * From myfile
where myfield = : someDateFieldCHAR;

Exec SQL
Open C1;
if SqlCod <> 0;
/handle error
endif;


Exec SQL
Fetch Next From C2 into :MyFile_DS;
if SqlCod <> 0;
/handle error
endif;


But only because he opens and closes the cursor, right? A chain would not need this.

However, remember my motto, "If you're using a cursor you're
probably doing something wrong." You might see the term RBAR
thrown about when it comes to cursors, especially in MS SQL
Server forums.

RBAR stands for Row-By-Agonizing-Row.

There are a few places where you have to use cursors, but
this isn't one of them!


Charles, I used a cursor a couple of times when learning embedded sql. But now I never see an advantage for using one. When <would> it be a the right place?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2026 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.