Compare number value in if statement
SQL> CREATE TABLE myTable(
2 e INTEGER,
3 f INTEGER
4 );
Table created.
SQL>
SQL> DELETE FROM myTable;
0 rows deleted.
SQL> INSERT INTO myTable VALUES(1, 3);
1 row created.
SQL> INSERT INTO myTable VALUES(2, 4);
1 row created.
SQL>
SQL> DECLARE
2 a NUMBER;
3 b NUMBER;
4 BEGIN
5 SELECT e,f INTO a,b FROM myTable WHERE e>1;
6 IF b=1 THEN
7 INSERT INTO myTable VALUES(b,a);
8 ELSE
9 INSERT INTO myTable VALUES(b+10,a+10);
10 END IF;
11 END;
12 /
PL/SQL procedure successfully completed.
SQL> drop table myTable;
Table dropped.
SQL>
Related examples in the same category