10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How You Can Access a Database with Standard SQL StatementsSelect StatementThe select statement lets you retrieve data from the database into:• Simple variables• Reference variables• Array variablesIf the variable receiving data is associated with a field on a form that iscurrently displayed, the data is displayed in the field as it is assigned to thevariable.A select statement can retrieve:A single rowA select statement that retrieves only one row is called a singleton select.The select statement deposits the retrieved data into variables that theprogram can process as needed.Multiple rowsWhen a select statement returns more than one row, only the first rowreturned is visible to the program. To access the additional rows, use oneof the following constructs:Select loopA select loop is a block of 4GL statements that are performed on eachrow returned by the select statement. The loop ends when there areno more rows or an endloop statement is encountered. Select loopsare the simplest and often most efficient way to handle multiple rows.CursorA cursor is a row marker that designates an individual row in the selectstatement's result table (the set of rows returned by a non-singletonselect). As the program moves the cursor forward through the resulttable, you can update or delete the row to which the cursor points aswell as use the values in the row.For a detailed discussion of cursors in OpenROAD and examples of theiruse, see How You Can Use Cursors to Access the Database (see page 157).Working with a Database 149

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!