powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / commit закрывает курсор ?
4 сообщений из 4, страница 1 из 1
commit закрывает курсор ?
    #35284000
Марсель
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
asa 902
подскажите, так должно быть, когда Commit или autocommit-действие закрывает курсор ?
для примера:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
begin
  declare a long varchar;
  declare curs1 cursor for
    select 'create table t(id integer);' FROM DUMMY for READ ONLY;

  open curs1;
  fetch curs1 into a;
  execute immediate a; //commit;
  close curs1;
end

будет ругаться на close curs1

заранее спасибо!
...
Рейтинг: 0 / 0
commit закрывает курсор ?
    #35284031
стакан
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
а зачем здесь вообще курсор?!
...
Рейтинг: 0 / 0
commit закрывает курсор ?
    #35284238
White Owl
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Марсельподскажите, так должно быть, когда Commit или autocommit-действие закрывает курсор ?Да, так должно быть.
Читать BOL.
SQL Anywhere® Server - Programming > Using SQL in Applications > Controlling transactions in applications > Cursors and transactionsIn general, a cursor closes when a COMMIT is performed. There are two exceptions to this behavior:

The close_on_endtrans database option is set to Off.

A cursor is opened WITH HOLD, which is the default with Open Client and JDBC.

If either of these two cases is true, the cursor remains open on a COMMIT.

ROLLBACK and cursors
If a transaction rolls back, then cursors close except for those cursors opened WITH HOLD. However, don't rely on the contents of any cursor after a rollback.

The draft ISO SQL3 standard states that on a rollback, all cursors (even those cursors opened WITH HOLD) should close. You can obtain this behavior by setting the ansi_close_cursors_on_rollback option to On.

Savepoints
If a transaction rolls back to a savepoint, and if the ansi_close_cursors_on_rollback option is On, then all cursors (even those cursors opened WITH HOLD) opened after the SAVEPOINT close.

Cursors and isolation levels
You can change the isolation level of a connection during a transaction using the SET OPTION statement to alter the isolation_level option. However, this change does not affect open cursors.
...
Рейтинг: 0 / 0
commit закрывает курсор ?
    #35284871
Марсель
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Спасибо White Owl
Код: plaintext
WITH HOLD
ед. что в For-statement его не вставишь
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / commit закрывает курсор ?
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]