Use the Execute block in SQL

4

Is there a way to find two fields (in different tables), compare them and if they are different to perform an update? Could you give me a brief example if there is any way, using EXECUTE BLOCK .

    
asked by anonymous 15.06.2015 / 15:47

1 answer

1

Something like this:

    execute block
as
  begin
    IF ( (select numero from btr01 where numero=150000) = (select numero from btr01 where numero=150001))
        THEN update btr01 set serie='123' where numero=150000;
        ELSE update btr01 set serie='321' where numero=150001;
  end
    
15.06.2015 / 20:43