Guest User

Untitled

a guest
Jul 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. SELECT
  2. id
  3. FROM table_name tkn1,
  4. (SELECT
  5. id,
  6. ROWNUM rnum
  7. FROM table_name
  8. WHERE
  9. PROCS_DT is null
  10. order by PRTY desc, CRET_DT) result
  11. WHERE tkn1.id= result.id
  12. AND result.rnum <= 10 FOR UPDATE OF tkn1.id SKIP LOCKED
  13.  
  14. create table gm_temp
  15. as select rownum id, table_name obj_name, date '2011-01-01' + rownum create_date
  16. from all_tables where rownum < 500;
  17.  
  18. CREATE TYPE tab_number IS TABLE OF NUMBER;
  19.  
  20. DECLARE
  21. cursor c_table IS
  22. SELECT id FROM gm_temp ORDER BY create_date DESC FOR UPDATE OF id SKIP LOCKED;
  23. t_table_src tab_number := tab_number();
  24. BEGIN
  25. OPEN c_table;
  26. FETCH c_table BULK COLLECT INTO t_table_src LIMIT 10;
  27. CLOSE c_table;
  28. dbms_output.put_line(':'||t_table_src.count||':'||t_table_src(1));
  29. END;
Add Comment
Please, Sign In to add comment