SELECTBLOB

Description

Selects a single blob column in a row in the table specified in RestOfSelectStatement.

Syntax

SELECTBLOB RestOfSelectStatement 
	{USING TransactionObject} ;

Parameter

Description

RestOfSelectStatement

The rest of the SELECT statement (the INTO, FROM, and WHERE clauses).

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).

Usage

An error occurs if the SELECTBLOB statement returns more than one row.

NoteError 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.

NoteDatabase 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

Example 1

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):

Blob Emp_id_pic

SELECTBLOB Emp_pic

		INTO :Emp_id_pic 

		FROM Employee

		WHERE Employee.Emp_Num = 100

		USING Emp_tran ;

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.