UPDATEBLOB SQL statement
Description
Updates the rows in TableName in BlobColumn.
Syntax
|
1 |
UPDATEBLOB <span>TableName</span> <br> SET <span>BlobColumn</span> = <span>BlobVariable</span><br> RestOfUpdateStatement {USING <span>TransactionObject</span>} ; |
|
Parameter |
Description |
|---|---|
|
TableName |
The name of the table you want to update. |
|
BlobColumn |
The name of the column you want to update |
|
BlobVariable |
A PowerScript variable of the datatype |
|
RestOfUpdateStatement |
The rest of the UPDATE statement |
|
TransactionObject |
The name of the transaction object that |
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
Sybase 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 |
int  fh |
|
1 |
blob Emp_id_pic |
|
1 |
fh = FileOpen("c:emp_100.bmp", StreamMode!) |
|
1 |
IF fh <> -1 THEN |
|
1 |
FileRead(fh, emp_id_pic) |
|
1 |
FileClose(fh) |
|
1 |
UPDATEBLOB Employee SET emp_pic = :Emp_id_pic |
|
1 |
WHERE Emp_num = 100 |
|
1 |
USING Emp_tran ; |
|
1 |
END IF |
|
1 |
|
1 |
IF Emptran.SQLNRows > 0 THEN |
|
1 |
COMMIT USING Emp_tran ; |
|
1 |
END IF |
The blob Emp_id_pic requires
a colon to indicate it is a host (PowerScript) variable in the UPDATEBLOB statement.