OSQL UPDATE Command

PURPOSE:  This command changes data in columns of existing rows in a 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 UPDATE table_name
             {SET str_exp WITH WINDOW}
             [WHERE str_exp]
             [INCLUDE include_list]
             [DEFINE PM process_module_name [ONLY]]

table_name

is the name of the table that will be updated.

SET str_exp

for each column for which you are assigning a value, use this basic format in the string:

            column_name = expression

This string can be built dynamically from within the Process Module.  When more than one column name and value pair are listed, they must be separated by commas.

WITH WINDOW

specifies that a window containing the columns from the table will be displayed on the screen.  The window uses the SMF window development language of ACCENT R.

WHERE str_exp

You can set the string to any valid WHERE clause including column names, expressions, arithmetic operators, comparison operators, the keywords NOT, LIKE, IS NULL, AND, OR, BETWEEN, IN, EXISTS, ANY, ALL, sub-queries, or any combination of these items.  This string can be built dynamically from within the Process Module.  There is no limit on the number of search conditions that can be included.  This search condition cannot contain aggregates.  See the 'WHERE clause' in the Oracle SQL Language Reference Manual for details.  Note all literals must be enclosed within single quote marks (i.e. '  ').

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.

Examples

*OSQL UPDATE BOOKS_ORA SET BOOKS_ORA.TITLE_TYPE = 'FOREIGN' &
   WHERE BOOKS_ORA.TITLE_TYPE = 'for_lang'
*OSQL UPDATE SALES_ORA WITH WINDOW DEFINE PM SALES_CHANGE

SQL Update Command

Figure 18 SQL UPDATE Command

SEE ALSO:  SQL UPDATE statement

OSQL Select Command    OSQL USE Command