CLOSE statement [ESQL] [SP]
416
CLOSE statement [ESQL] [SP]
Use this statement to close a cursor.
CLOSE
cursor-name
cursor-name:
{
identifier
|
host-variable
}
The cursor must have been previously opened.
None.
"OPEN statement" on page 570
"DECLARE CURSOR statement" on page 488
"PREPARE statement" on page 578
This statement closes the named cursor.
♦
SQL/92 Entry-level feature.
♦
Sybase Supported by Adaptive Server Enterprise.
The following examples close cursors in embedded SQL.
EXEC SQL CLOSE employee_cursor;
EXEC SQL CLOSE :cursor_var;
The following procedure uses a cursor.
CREATE PROCEDURE TopCustomer (OUT TopCompany
CHAR(35), OUT TopValue INT)
BEGIN
DECLARE err_notfound EXCEPTION
FOR SQLSTATE ’02000’;
DECLARE curThisCust CURSOR FOR
SELECT company_name, CAST(
sum(sales_order_items.quantity *
product.unit_price) AS INTEGER) VALUE
FROM customer
LEFT OUTER JOIN sales_order
LEFT OUTER JOIN sales_order_items
LEFT OUTER JOIN product
GROUP BY company_name;
DECLARE ThisValue INT;
DECLARE ThisCompany CHAR(35);
SET TopValue = 0;
OPEN curThisCust;
Function
Syntax
Permissions
Side effects
See also
Description
Standards and
compatibility
Examples