swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts   Other Library Functions  
function  

db.move-record

 
 

Library: Interfaces, Database access (OMDB)
Import: omdb.xmd

Declaration

  define external  function db.move-record
         read-only db.field  record

  or

  define external  function db.move-record
         read-only db.field  record
      to value     integer  absolute

  or

  define external  function db.move-record
         read-only db.field  record
      by value     integer  relative

Argument definitions

record
is a db.field shelf bound to a record set created by an SQL query
absolute
is the absolute position to which to move the cursor. A positive number indicates the number of records from the beginning, with +1 being the first record. A negative number indicates the position from the end, with -1 being the last record.
relative
is the number of rows to move the cursor. This value can be either positive or negative, with negative values indicating reverse movement within the record set.


Purpose

Use db.move-record to change the position of the data cursor within the specified record set.

Requirements

The database connection represented by db.database must be

The db.field shelf must be associated with a query (else external exception OMDB302).

The db.field shelf record must exist.

The absolute parameter must:

The relative parameter must:

Usage Notes

The data cursor points to the currently active row of the record set. By default (neither the absolute nor the relative parameter is supplied), the cursor advances to the next row of the record set.

You can move the data cursor beyond the record set boundaries. However, if you attempt to retrieve a field value in this situation, external exception OMDB205 will be thrown. Hint: Before attempting to retrieve field values, you should use the db.record-exists function to verify that the data cursor is within the record set boundaries.

What sort of cursor movement is possible depends on the database and database interface being used. If using the OCI8 or OCI8i interface, you can only advance to the next record. Some ODBC drivers allow additional flexibility.

Example


        repeat
           exit unless db.record-exists my-query

           repeat over my-query
              output db.reader of my-query null '-dnf-'
              output '%t' when ! #last
           again
           output '%n'

           db.move-record my-query
         again

    Related Syntax
   db.query
   db.record-exists
   db.reader
   db.field
 
Related Concepts
   Using the OMDB library
 
Other Library Functions
   db.advance-recordset
   db.close
   db.commit
   db.compile-statement
   db.database
   db.delete
   db.discard
   db.execute
   db.execute-in
   db.field
   db.insert
   db.move-record
   db.omdb-version
   db.omdb-version-oci8
   db.omdb-version-oci8i
   db.omdb-version-odbc
   db.open-oci8
   db.open-oci8i
   db.open-odbc
   db.open-procedure
   db.open-table
   db.prepare
   db.procedure
   db.query
   db.reader
   db.record-exists
   db.rollback
   db.set-transaction-type
   db.statement
   db.streaming-execute
   db.table
   db.update
   db.writer
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:03 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.