powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Firebird, InterBase [игнор отключен] [закрыт для гостей] / update T set X = ... where current of <C> returning X into ... - не работает в 2.5. Why ?
4 сообщений из 4, страница 1 из 1
update T set X = ... where current of <C> returning X into ... - не работает в 2.5. Why ?
    #38712196
Таблоид
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
hi all

DDL:
Код: plaintext
1.
2.
3.
4.
recreate table t(id int, x int);
commit;
insert into t values(1, 100);
commit;

Из доки и /doc/sql/readme.cursors.txt следует, что вот эта вот штучка:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
execute block returns(new_x int) as
  declare i int = 1;
  declare x int;
  declare c cursor for(select x from t where id = :i);
begin
  open c;
  while (1=1) do
  begin
    fetch c into x;
    if ( row_count = 0) then leave;
    update t set x = :x * 2
     where current of c 
    --where id = :i
    returning x into new_x;
    suspend;
  end
  close c;
endd

- должна работать, начиная с 2.1.

На 3.0 - да, всё работает Ок.
Ввожу на LI-V6.3.3.26788 Firebird 2.5 - получаю шваброй:
Код: plaintext
1.
2.
3.
4.
5.
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 14, column 5.
returning.

Для пропихивания в 2.5 надо заменить строку:
Код: plaintext
     where current of c 
на
Код: plaintext
    where id = :i
(ну, или rdb$db_key там юзать)

А почему, соб-сно ?
...
Рейтинг: 0 / 0
update T set X = ... where current of <C> returning X into ... - не работает в 2.5. Why ?
    #38712205
Таблоид
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Таблоид
Код: plaintext
1.
2.
. . .
  close c;
end d 
- пардон, это очепятка, ес-но (при вводе сюда).

Вот код для проверки:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
set term ^;
execute block returns(new_x int) as
  declare i int = 1;
  declare x int;
  declare c cursor for(select x from t where id = :i);
begin
  open c;
  while (1=1) do
  begin
    fetch c into x;
    if ( row_count = 0) then leave;
    update t set x = :x * 2
    where current of c
    --where id = :i
    returning x into new_x;
    suspend;
  end
  close c;
end
^
set term ;^
rollback;
...
Рейтинг: 0 / 0
update T set X = ... where current of <C> returning X into ... - не работает в 2.5. Why ?
    #38712210
Фотография Симонов Денис
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Таблоид,

CORE-3343 для 2.5 не фиксилось
...
Рейтинг: 0 / 0
update T set X = ... where current of <C> returning X into ... - не работает в 2.5. Why ?
    #38712220
Таблоид
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Симонов Денис,

спс.
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Firebird, InterBase [игнор отключен] [закрыт для гостей] / update T set X = ... where current of <C> returning X into ... - не работает в 2.5. Why ?
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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