테이블의 레코드를 업데이트하고 싶지만 조건에 따라 하나의 열 또는 다른 것을 업데이트하지만 두 개의 별도 명령문을 갖고 싶지 않습니다. 매우 길고 상세한.오라클 - 조건에 따라 하나의 열 또는 다른 업데이트하기
여기에 간략히 설명하면 기본 개념입니다.
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, 저를 때려주십시오. –