db.execute-in

function

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

Declaration
define external function db.execute-in
             value db.database database
         sql value string      statement optional initial {''}

or

define external function db.execute-in
             value db.database database
   statement value string      statement optional initial {''}

Argument definitions

database
is a db.database object obtained by opening a connection to a database using one of the db.open functions.
statement
is the statement that you want to execute on the database.


Purpose

Use db.execute-in to execute a single statement on the specified database.

Requirements

The db.database object database must be:

The string variable statement must not be empty (else external exception OMDB105).

Usage Notes

When working with a relational database, the SQL statement may modify the structure of the database or manipulate the data in the tables. It may be any non-select type of SQL statement.

Example - Relational Database:

This example shows how to use execute-in to insert updated course information into an ODBC database:

  import "omdb.xmd" prefixed by db.
  process
     local db.database my-database
           initial {db.open-odbc "dbDemo"}
  
     db.execute-in my-database
        sql ("insert into Course (cid, CourseName)"
             || " values ('456', 'Four-on-the-Floor Gearshifting')")