SELECTBLOB SQL statement
Description
Selects a single blob column in a row in the table specified
in RestOfSelectStatement.
Syntax
|
1 |
SELECTBLOB <span>RestOfSelectStatement <br> </span>{USING <span>TransactionObject</span>} ; |
|
Parameter |
Description |
|---|---|
|
RestOfSelectStatement |
The rest of the SELECT statement |
|
TransactionObject |
The name of the transaction object that |
Usage
An error occurs if the SELECTBLOB statement
returns more than one row.
Error handling
It is good practice to test the success/failure code
after executing an SELECTBLOB 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 SELECTBLOB statement.
You can include an indicator variable in the host variable
list (target parameters) in the INTO clause to
check for an empty blob (a blob of zero length) and conversion errors.
Database information
Sybase ASE users must set the AutoCommit property of the transaction
object to true before calling the SELECTBLOB function.
For information about the AutoCommit property, see Connecting
to Your Database.
Examples
The following statements select the blob column Emp_pic from
a row in the Employee table and set the picture p_1 to
the bitmap in Emp_id_pic (the transaction
object Emp_tran is used):
|
1 |
Blob Emp_id_pic |
|
1 |
SELECTBLOB Emp_pic |
|
1 |
INTO :Emp_id_pic |
|
1 |
FROM Employee |
|
1 |
WHERE Employee.Emp_Num = 100 |
|
1 |
USING Emp_tran ; |
|
1 |
p_1.SetPicture(Emp_id_pic) |
The blob Emp_id_pic requires
a colon to indicate that it is a host (PowerScript) variable when
you use it in the INTO clause of the SELECTBLOB statement.