Problem to select not in
create table t1 (x varchar2(2));

insert into t1 (x) values ('1');
insert into t1 (x) values ('2');
insert into t1 (x) values ('3');
insert into t1 (x) values ('5');
insert into t1 (x) values ('6');
insert into t1 (x) values ('8');
insert into t1 (x) values ('9');
insert into t1 (x) values ('10');
insert into t1 (x) values ('11');
commit;

SQL&gt;  select level as x
  2     from dual
  3  connect by level &lt;= 9
  4    minus
  5   select to_number(x)
  6     from t1;

         X
----------
         4
         7

2 rows selected.