Description

Updates the data content of a specified column in a row in a table.

Syntax

WriteV expression on | to filevar, key, column then | else statements

Parameters

The WriteV statement has the following parameters.

ParameterDescription
ExpressionEvaluates to the column contents that are to be written to the table.
FilevarRefers to a file variable that has been opened in a previous Open statement. The WriteV statement does not support file access using cursors.
KeySpecifies the key of the row to be written.
ColumnThe number of the column that is to be updated. The value of column must be greater than zero.
ThenThe statement(s) following Then are executed if the column is written successfully.
ElseThe statement(s) following Else are executed if the column cannot be written. The Status() function indicates the severity of the error, and the system variable @FILE_ERROR contains detail about the nature of the error.

See also

MatReadMatWriteOpenReadReadVWrite

Example

/* The program reads column 5 from the CUSTOMER record 100, and assigns a value to row. 
The new record variable is then written to column 5. */
 
open "CUSTOMER" To CUSTOMER_TABLE then
  @ID = 100
  readV column From CUSTOMER_TABLE, @ID, 5 then
    * make no presumptions about the case
 
    FIRST_CHARACTER = column[1,1]
 
    Convert @LOWER_CASE To @UPPER_CASE In FIRST_CHARACTER
 
    Convert @UPPER_CASE To @LOWER_CASE In column
 
    column[1,1] = FIRST_CHARACTER
    writeV column On CUSTOMER_TABLE, @ID, 5 else
      status = Set_FSError()
    end
  end
end
  • No labels