Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.05.30;
Скачать: CL | DM;

Вниз

Логическая ошибка в триггере   Найти похожие ветки 

 
}|{yk ©   (2004-05-07 11:12) [0]

На insert и update срабатывает нормально, а на delete - устанавливает значение в null

AS
declare variable out_free_cash double precision;
begin
if (inserting or updating) then
 begin
select a.left_to_raspr from get_free_cash(new.plat_id) a into :out_free_cash;
update app_plateg a set a.free_cash=:out_free_cash where a.plat_id=new.plat_id;
 end
if (deleting) then
  begin
select a.left_to_raspr from get_free_cash(old.plat_id) a into :out_free_cash;
update app_plateg a set a.free_cash=:out_free_cash where a.plat_id=old.plat_id;
 end


 
Reindeer Moss Eater ©   (2004-05-07 11:15) [1]

После селекта в ветке удаления параметр принимает значение null


 
Курдль ©   (2004-05-07 11:17) [2]

А он after или before?


 
}|{yk ©   (2004-05-07 11:19) [3]

Триггер after insert, update, delete

Функция get_free_cash(new.plat_id)
begin
 select a.plat_sum from app_plateg a where a.plat_id=:inplat_id into :fullsumm;
 select sum(a.summa) from app_bank a where a.plat_id=:inplat_id into :already_raspr;
 left_to_raspr=:fullsumm-:already_raspr;
 suspend;
end


 
Курдль ©   (2004-05-07 11:28) [4]

А что показывает трассировка триггера?


 
}|{yk ©   (2004-05-07 11:38) [5]

Все, решил
Нужно было
 select coalesce(sum(a.summa),0) from app_bank a where a.plat_id=:inplat_id into :already_raspr;
иначе мог возвращаться null



Страницы: 1 вся ветка

Текущий архив: 2004.05.30;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.046 c
6-1081873337
AlDan
2004-04-13 20:22
2004.05.30
Создание каталога на сетевом диске


11-1074703352
Vladimir Kladov
2004-01-21 19:42
2004.05.30
Версия 1.90


7-1083046670
Hecker
2004-04-27 10:17
2004.05.30
Аналоговый сигнал с модем в WAV файл?


1-1084888831
ПрогерШу
2004-05-18 18:00
2004.05.30
Как изменить значение структуры по ссылке?


14-1084374073
konstantinov
2004-05-12 19:01
2004.05.30
Создание скомпилированных HTML файлов