UPDATEBLOB
SQL statement
Description
Updates the rows in TableName in BlobColumn.
Syntax
|
1 2 3 |
UPDATEBLOB TableName SET BlobColumn = BlobVariable RestOfUpdateStatement {USING TransactionObject} ; |
|
Parameter |
Description |
|---|---|
|
TableName |
The name of the table you want to |
|
BlobColumn |
The name of the column you want to update in |
|
BlobVariable |
A PowerScript variable of the datatype |
|
RestOfUpdateStatement |
The rest of the UPDATE statement (the |
|
TransactionObject |
The name of the transaction object that identifies |
Usage
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.
Database information
SAP ASE users must set the AutoCommit property of the
transaction object to True before calling the UPDATEBLOB function. For
information about the AutoCommit property, see Connecting to Your
Database.
Examples
These statements update the blob column emp_pic in the
Employee table, where emp_num is 100:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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.