OSQL INSERT Command

PURPOSE: This statement adds or inserts one or more rows of data into the specified table.  If the WITH WINDOW clause is specified, then an SMF window will be displayed on the screen.  If the DEFINE PM clause is included, then the process module created to execute the command will be saved in the current DBL under the object name specified.

Syntax

OSQL INSERT /INTO/ table_name
     
[(column_list)]
      {WITH WINDOW; VALUES (\\constant_expression\\); select_str_exp}
      [INCLUDE include_list]
      [DEFINE PM process_module_name [ONLY]]

table_name

is the table to which data will be added.

(column_list)

a list of one or more columns for the specified table.  The columns can be in any order, but the incoming data must be in the same order.  Note that the parentheses must be entered as a part of the statement. The column_list is only necessary when some, but not all, of the columns in the table are to receive data.  The column_list determines the order in which values are entered.  If a column_list is not specified, all of the columns in the table are assumed to be receiving data.  In this case, the order of the columns is assumed to be the same as used when the table was created.

WITH WINDOW

specifies that a window containing the columns from the table will be displayed on the screen.  This clause allows on-line input and is mutually exclusive of the VALUES and select_str_exp clauses.  The window uses the SMF window development language of ACCENT R.

VALUES

specifies the field or constant values for the indicated columns.

(\\constant_expression\\)

The value list must match the explicit or implicit column_list.  Note that the parentheses must be entered as a part of the statement.

select_str_exp

is a quoted literal, a character or an alphabetic field, a function, or a concatenation of any of the preceding that evaluates to a string that represents an SQL SELECT statement used to retrieve the values to be inserted.  This string can be built dynamically from within the Process Module.  The select_list of the SQL SELECT statement must match the explicit or implicit column_list.

INCLUDE include_list

includes code from a Code Segment (CS) into a particular section/location within the OSQL generated process module.

DEFINE PM process_module_name

specifies that the process module containing the code generated to execute the OSQL command be saved and named as an object in the current DBL.  This process module is made up of ACCENT R SPL and SMF statements and is useful for prototyping applications.  Defining the Process Module causes your OSQL command to be compiled for faster execution.

ONLY

specifies that the Process Module will be created without being executed by OSQL.  This clause is used primarily by the OSQL BUILD command but may also be used for on-line prototyping.  If you include the ONLY clause then you must invoke the Process Module interactively.

Example

*OSQL INSERT INTO STORES_ORA WITH WINDOW DEFINE PM ADD_STORES

OSQL Insert Command

Figure 15 OSQL INSERT Command

NOTES:  The rows you update through OSQL are automatically committed to the Oracle Server.

SEE ALSO:  SQL INSERT statement

OSQL Import Command    OSQL Menu Command