UPDATE [RECORD ] [IN ] [STATEMENT ] [(r)]
|
UPDATE
|
[RECORD ]
[IN ] [STATEMENT ] [(r)]
|
|||||
SET
|
||||||
WITH
|
SAME
[RECORD ]
|
|||||
USING
|
{operand1= operand2}
|
This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
Related Statements: ACCEPT/REJECT
|
AT BREAK
|
AT START OF DATA
|
AT END OF DATA
|
BACKOUT TRANSACTION
|
BEFORE BREAK PROCESSING
|
DELETE
|
END TRANSACTION
|
FIND
|
GET
|
GET SAME
|
GET TRANSACTION DATA
|
HISTOGRAM
|
LIMIT
|
PASSW
|
PERFORM BREAK PROCESSING
| READ
|
RETRY
|
STORE
Belongs to Function Group: Database Access and Update
The UPDATE
statement is used to update one or more fields
of a record in a database. The record to be updated must have been previously
selected with a FIND
,
GET
or
READ
statement (or, for
Adabas only, with a STORE
statement).
The use of the UPDATE
statement causes each record read
for processing in the corresponding FIND
or READ
statement to be placed in hold
status.
For further information, see Record Hold Logic (in the Programming Guide).
The UPDATE
statement must not be entered on the same line
as the statement used to select the record to be updated.
The UPDATE
statement cannot be applied to Entire System
Server views.
SQL |
The With most SQL databases, a row that was read with a
|
---|---|
XML |
The statement cannot be used with XML databases. |
Operand Definition Table:
Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operand1
|
S | A | A | N | P | I | F | B | D | T | L | no | no | |||||||
operand2
|
C | S | A | A | N | P | I | F | B | D | T | L | yes | no |
Syntax Element Description:
Syntax Element | Description |
---|---|
(r)
|
Statement Reference:
The notation
If no reference is specified, the Note: |
USING SAME
|
USING SAME Clause:
This clause is not permitted if a The layout of the record buffer or format buffer may be declared
using the
If the field to be updated is an array range of a multiple-value
field or periodic group and you use a variable index for this array range, the
latest range will be updated. This means that if the index variable is modified
after the record has been read and before the |
SET/WITH
operand1=operand2
|
SET/WITH Clause:
This clause can be used in reporting mode to specify the fields to be updated and the values to be used. This clause is not permitted if a |
** Example 'UPDEX1S': UPDATE (structured mode) ** ** CAUTION: Executing this example will modify the database records! ************************************************************************ DEFINE DATA LOCAL 1 EMPLOY-VIEW VIEW OF EMPLOYEES 2 NAME 2 FIRST-NAME 2 CITY * 1 #NAME (A20) END-DEFINE * INPUT 'ENTER A NAME:' #NAME (AD=M) IF #NAME = ' ' STOP END-IF * FIND EMPLOY-VIEW WITH NAME = #NAME IF NO RECORDS FOUND REINPUT WITH 'NO RECORDS FOUND' MARK 1 END-NOREC INPUT 'NAME: ' NAME (AD=O) / 'FIRST NAME:' FIRST-NAME (AD=M) / 'CITY: ' CITY (AD=M) UPDATE END TRANSACTION END-FIND * END
ENTER A NAME: BROWN
NAME: BROWN FIRST NAME: KENNETH CITY: DERBY
Equivalent reporting-mode example: UPDEX1R
.