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

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - SQL Reference » Using SQL » SQL functions » SQL functions (P-Z)


PLAN function [Miscellaneous]

Returns the long plan optimization strategy of a SQL statement, as a string.

PLAN( string-expression, [ cursor-type ], [ update-status ]  )
  • string-expression   The SQL statement, which is commonly a SELECT statement but which may also be an UPDATE or DELETE statement.

  • cursor-type   A string. cursor-type can be asensitive (default), insensitive, sensitive, or keyset-driven.

  • update-status   A string parameter accepting one of the following values indicating how the optimizer should treat the given cursor:

Value Description
READ-ONLY The cursor is read-only.
READ-WRITE (default) The cursor can be read or written to.
FOR UPDATE The cursor can be read or written to. This is exactly the same as READ-WRITE.


See also
Standards and compatibility
  • SQL/2003   Vendor extension.


The following statement passes a SELECT statement as a string parameter and returns the plan for executing the query.

   'SELECT * FROM Departments WHERE DepartmentID > 100' );

This information can help with decisions about indexes to add or how to structure your database for better performance.

The following statement returns a string containing the text plan for an INSENSITIVE cursor over the query SELECT * FROM Departments WHERE DepartmentID > 100;.

   'SELECT * FROM Departments WHERE DepartmentID > 100',
   'read-only' );