Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 6 Manipulating Data in a Table : Replacing Data

Replacing Data
Replacing Data Using the Table Editor
To replace values in a field using the Table Editor, you can:
When you overtype or delete existing values, press Enter to update the table with the new values.
Replacing Data Using the CHANGE Command from the Table Editor
When using the CHANGE command, you must enter the field name, the value that is changed, and the new value. For example, type change deptno=10 60 in the primary command field. Deptno is the field name, 10 is the value that is changed, and 60 is the new value.
Notes on the CHANGE Command
Enclose values (constants) with spaces or non-numeric characters in single quotation marks. For example, type change position=’staff pe’ ’resources’ in the primary command field.
Controlling the Scope of the CHANGE Command
You have three options that control the scope of the CHANGE command:
The options REST and ALL, if used on large tables, could cause the commit limit to be reached. If the commit limit is reached, save your updates to this point, re-enter the command, and continue making the changes.
Controlling the Scope with the PAGE Option
The PAGE option limits the scope of the CHANGE command to occurrences on the displayed page. Occurrences above or below the displayed page remain unchanged. All changes are visible.
For example, typing change deptno=10 60 page in the primary command field changes all occurrences that you can currently see with department number 10 to department number 60. When the changes are made, the message line displays the number of changes made (possibly 0).
Controlling the Scope with the REST Option
The REST option limits the scope of the CHANGE command to occurrences on the displayed page or on the pages after the displayed one. Occurrences on pages before the displayed one remain unchanged. Some changes could be invisible.
For example, typing change deptno=10 60 rest in the primary command field changes all occurrences on the display screen and below with department number 10 to department number 60. When the changes are made, the message line displays the number of changes made (possibly 0).
Controlling the Scope with the ALL Option
The ALL option changes the scope of the CHANGE command to the entire table. All occurrences with the specified field value are changed to the new value.
For example, typing change deptno=10 60 all in the primary command field changes all occurrences with department number 10 to department number 60. The message line displays the number of changes made (possibly 0).
Replacing Data Using the Single Occurrence Editor
To replace data using the Single Occurrence Editor, invoke the Single Occurrence Editor and overtype or delete the existing data. Type SAVE or press PF3 to save the changes, update the table, and exit from your editing session.
Replacing Data Using a Rules Statement
To replace data using a rules statement, use the REPLACE statement. First retrieve the data that you want to modify using a GET or FORALL statement. You cannot select a field using the REPLACE statement but you can use a WHERE clause to select a table instance. You also cannot replace a primary key value using the REPLACE statement.
Example Rule for of Replacing Data

 
REPLACE_DEPTNO(region, empno, deptno);
_
_ ---------------------------------------------------------------------------
_ ------------------------------------------------------------+--------------
_ FORALL @EMPLOYEES WHERE REGION = REGION : | 1
_ @EMPLOYEES.DEPTNO = DEPTNO; |
_ REPLACE @EMPLOYEES WHERE REGION = REGION; |
_ END; |
_ ---------------------------------------------------------------------------

 
Explanation of the Rule
The previous rule:
1.
Retrieves an occurrence in the @EMPLOYEES table based on the parameter value provided for the argument REGION and the value provided for EMPNO.
2.
3.
See Also
TIBCO Object Service Broker Programming in Rules for information on rules and the REPLACE statement.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved