http://chenhua-1984.iteye.com/blog/990970
http://chenhua-1984.iteye.com/blog/996018
begin
begin while(true) loop select seq_user_number.nextval into result from dual; select user_number into user_number from user_number where user_number=result; end loop; exception when no_data_found then dbms_output.put_line(result); end; return result; end;