Я хочу обновить запись в таблице, но на основе условия я либо обновляю один столбец, либо не хочу иметь 2 отдельных оператора, потому что инструкции очень длинный и подробный.Oracle - обновление одного столбца на основе условия
Вот основная идея с упрощением, чтобы добраться до точки.
PROCEDURE Animal_something(p_updater VARCHAR2)
begin
if p_updater = 'person' then
-- I want to update the modified_by
else
-- if p_updater = 'a process' I want to update modified_by_process
Update table_creatures
set animal_type = 'Dog ,
**modified_by** = 'Bob'
**or do this**
**modified_by_process =** 'creature_package'
where animal_legs = '4'
Я не хочу:
if p_updater = 'person' then
Update table_creatures
set animal_type = 'Dog ,
modified_by = 'Bob'
where animal_legs = '4';
else
Update table_creatures
set animal_type = 'Dog ,
modified_by_process = 'creature_package'
where animal_legs = '4';
end;
+1, избивайте меня :) –