Ich möchte einen Datensatz in einer Tabelle aktualisieren, aber auf der Grundlage einer Bedingung werde ich entweder eine Spalte oder eine andere aktualisieren, aber ich möchte nicht 2 separate Anweisungen haben, weil die Anweisungen sehr lang und detailliert sind.
Hier ist der Grundgedanke mit einer starken Vereinfachung, um auf den Punkt zu kommen.
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'
I nicht wollen :
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;