Fetch-All Statement

Fetches all rows of a result set starting from the current row position in the result set and moving sequentially forward, and sets the row position behind the last row (eos condition is true). Ident is the name of the cursor used for the corresponding SQL SELECT command.

Syntax

Stat = "fetch" Ident "all".

Example

var
sArtname : string;
nArtno, nPrice : number;
dcltrans
transaction TMain
begin
c1: SelArticle();
fetch c1 all;
end TMain;
dclsql
SelArticle:
SELECT articlenumber, price, name
INTO :nArtno, :nPrice, :sArtname
FROM article WHERE price > 100
ORDER BY price DESC;

After execution of the SQL command SelArticle, a result set is created containing all articles where the price is greater than 100. The row position is set to the first row in the result set. At this time the values of the first row are bound to the variables v_artno, v_price and v_artname. The fetch c1 all statement fetches all rows of the result set sequentially forward starting from the current row position. The eos condition for the cursor used for the result set is set to true.