Subject Need help with running for select... do loop through isql
Author josephhirn
Hello. I need to prepare a maintainence script for a database
corruption issue our application is having at various sites. i have a
pretty good background in MSSQL, DB2, and mysql, but not too much with
interbase.

Our environment is gentoo linux kernel 2.1.10 and firebird 1.0.3. I
would like call isql -in mySQL.sql and have this script execute but I
keep getting a message that FOR is an un known token. I would prefer
not to install a stored procedure as this script will have to be ran
ad-hoc and I do not wish to augment deployed databases by installing a
procedure. I need to run this from a .sql file.

I'm having a hard time understanding when and where to use semi's as a
terminating character as well.I followed the documentation as best as
I could but the only for select...do example was quite vague.Here is
my script so far:

/*START CODE*/
FOR Select id, document_id
from document_page dp
where not exists (...)
INTO :nPageID, nDocument_ID
DO
BEGIN
INSERT INTO endorsement (page_id,document_id,...)
VALUES (:nPageID, nDocument_ID, ...);
END
/* um.... do I terminate the for with ? */
/*END CODE*/

Any help is greatly apreciated.