Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

READTEXT statement [T-SQL]

Reads text and image values from the database, starting from a specified offset and reading a specified number of bytes. This feature is provided solely for compatibility with Transact-SQL and its use is not recommended.

Syntax
READTEXT table-name.column-name
text-pointer-offset text-size
[ HOLDLOCK ]
Remarks

READTEXT is used to read CHAR, NCHAR, and BINARY columns from a database. You cannot perform READTEXT operations on views.

Privileges

You must be the owner or have SELECT privileges on the table, or have the SELECT ANY TABLE system privilege.

Side effects

None.

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.

Example

The following Embedded SQL example uses TEXTPTR to locate the Description column associated with ProductID 500 in the MarketingInformation table.

The text pointer is stored in the variable txtptr and supplied as a parameter to the READTEXT statement which returns 55 bytes, starting at column offset 181.

EXEC SQL BEGIN DECLARE SECTION;
char            hostvar[100];
EXEC SQL END DECLARE SECTION;

EXEC SQL create variable txtptr binary(16);
EXEC SQL set txtptr =
    ( SELECT textptr(Description)
        FROM GROUPO.MarketingInformation
        WHERE ProductID = '500' );
EXEC SQL PREPARE S1 FROM
    'READTEXT GROUPO.MarketingInformation.Description txtptr 181 55';
EXEC SQL EXECUTE S1 INTO :hostvar;
printf( "hostvar: %s\n", hostvar );

READTEXT returns the following string.

Lightweight 100% organically grown cotton construction.