Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6321929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:14:12+00:00 2026-05-24T16:14:12+00:00

Can someone explain to me the syntax of the For loop in Firebird? Here

  • 0

Can someone explain to me the syntax of the For loop in Firebird?

Here is the code I have so far:

As 
Declare variable Var1 integer;
begin
Insert into table1 
-- Select query to insert some enteries in table 1 - Done successfully.
FOR SELECT table1.Column1 from table1 into :Var1 
Do
Begin 
Update tableabc.column1 = (select tablexyz. column1 from tablexyz where tablexyz.ID = :Var1) where tableabc.ID = :Var1 
End

Update : Thanks for giving it a try but i dont see any major difference between the query that i wrote and query included in answers. Although above query runs successfully at my end but when i see data in table there occurs no update.

Actually i was making a v.dumb mistake, i was executing alter stored procedure query – which runs successfully and i was assuming this would make the necessary changes. later i executed the stored procedure and it worked pefectly . Thanks all for sparing your time 🙂 ..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:14:13+00:00Added an answer on May 24, 2026 at 4:14 pm

    For operator in Firebird is not like For, say, in Pascal where it increments loop variable and executes a block of code until finish value will be met.

    In Firebird For operator takes a set of records (result of execution of a query) and loops through them. For every record a block of code will be executed. Optionally values of some fields from the record could be put into local variables enlisted in INTO section. Values of such variables could be used inside a block of code.

    In your example a query:

    SELECT table1.Column1 from table1 into :Var1
    

    Will be executed and for every record in result set will be executed operator:

    Update tableabc.column1 = 
      (select tablexyz. column1 from tablexyz where tablexyz.ID = :Var1) 
    where tableabc.ID = :Var1
    

    For it variable :Var will contain value of table1.Column1 of current record.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone explain the syntax in the source attribute here? What the heck is
Possible Duplicate: Can someone Explain this jQuery code? I have posted this before, but
Can someone explain in plain english the syntax of this: Here is the signature
Can someone explain the syntax in this block of code? Invoke((MethodInvoker) ( () =>
Can someone explain me the syntax below line 1? I am OK with js
Can someone explain what are the benefits of using the @import syntax comparing to
Can someone explain to me why this command reports The syntax of the command
Can someone explain why this code doesn't work as expected? I would expect it
Can someone explain this method declaration syntax for me? In this function, the number
Can someone explain to me what syntax this SQL query matches? SELECT DISTINCT boats.boatid

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.