Updates the rows in TableName in BlobColumn.
UPDATEBLOB TableName SET BlobColumn = BlobVariable RestOfUpdateStatement {USING TransactionObject} ;
Parameter |
Description |
---|---|
TableName |
The name of the table you want to update. |
BlobColumn |
The name of the column you want to update in TableName. The datatype of this column must be blob. |
BlobVariable |
A PowerScript variable of the datatype blob. |
RestOfUpdateStatement |
The rest of the UPDATE statement (the WHERE clause). |
TransactionObject |
The name of the transaction object that identifies the database containing the table. This clause is required only for transaction objects other than the default (SQLCA). |
Error handling It is good practice to test the success/failure code after executing an UPDATEBLOB statement. To make sure the update affected at least one row, check the SQLNRows property of SQLCA or the transaction object. The SQLCode or SQLDBCode property will not indicate the success or failure of the UPDATEBLOB statement.
These statements update the blob column emp_pic in the Employee table, where emp_num is 100:
int fh
blob Emp_id_pic
fh = FileOpen("c:\emp_100.bmp", StreamMode!)
IF fh <> -1 THEN
FileRead(fh, emp_id_pic)
FileClose(fh)
UPDATEBLOB Employee SET emp_pic = :Emp_id_pic
WHERE Emp_num = 100
USING Emp_tran ;
END IF
IF Emptran.SQLNRows > 0 THEN
COMMIT USING Emp_tran ;
END IF
The blob Emp_id_pic requires a colon to indicate it is a host (PowerScript) variable in the UPDATEBLOB statement.