general_manjago: (Default)
Kirill Temnenkov ([personal profile] general_manjago) wrote2008-06-18 08:44 am

exception when others then null



Ох, как же я ненавижу ковыряться в коде на PL/SQL, в котором встречаются конструкции типа
exception when others then return null! Хрен там в чем разберешься, если что-то пошло не так!

А недавно я просто впал в экстаз - там у чувака была гениальная функция
function Func return varchar2
is
begin
-- здесь что-то делается
exception when others then null
end;

А потом чувак написал что-то вроде

-- блок кода 1
select id into a from ... where field1 = Func
-- блок кода 2
exception when others then null;

В селекте возник-таки exception no_data_found, "блок кода 2" не выполнился - но пока мы до этого доперли....


Оригинал на http://www.itcommunity.ru/blogs/temnenkov/archive/2008/06/18/9868.aspx

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting