lundi 5 juillet 2021

Multiple conditions are true in If statement (Nefted If)

I have a nested if condition :

If (a > 0)
THEN 
  Delete from sample_table where id = 123;
   
    IF (b > 0)
       dummy = error_insert('x','y','The value of b is greater than 0',0);
     commit;
     Return;
     END IF;
END IF;

So I wanted to check if the variable a has greater than 0 and if so it should delete the value from sample_table and then check if the variable b has greater value than 0 and insert the values as mentioned.

But what it actually does it that checks if a is greater than 0 and directly goes to checking if b is greater than 0. It doesnt perform the delete statement.

Aucun commentaire:

Enregistrer un commentaire