Updating database records in a loop?

前端 未结 6 811
轮回少年
轮回少年 2021-02-10 09:19
declare
begin
  for i in (select * from emp)
  loop
    if i.sal=1300 then
      update emp
      set sal=13000;
    end if;
  end loop;
end;

This code

6条回答
  •  面向向阳花
    2021-02-10 09:46

    here's a quick solution that helps in removing the spaces (trimming) of a column data based on created date:

    UPDATE table_Name SET column_name = LTRIM(RTRIM(column_name)) 
    WHERE EXTEND(dateTime_column, YEAR TO DAY)='2020-01-31' ;
    

提交回复
热议问题