Advertisement
Guest User

APEX kolekcije

a guest
Jul 19th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. -- Upit za Classic Report
  2. select n001 as zaposlenik_id
  3. ,c001 as ime
  4. ,c002 as prezime
  5. ,d001 as datum_rodjenja
  6. ,c003 as spol
  7. from apex_collections
  8. where collection_name = 'ZAPOSLENIK';
  9.  
  10. -- BLOK 1
  11. if not apex_collection.collection_exists('ZAPOSLENIK') then
  12. apex_collection.create_or_truncate_collection('ZAPOSLENIK');
  13.  
  14. for rec in (select zaposlenik_id
  15. ,ime
  16. ,prezime
  17. ,datum_rodjenja
  18. ,spol
  19. from zaposlenik)
  20. loop
  21. apex_collection.add_member(
  22. p_collection_name => 'ZAPOSLENIK'
  23. ,p_n001 => rec.zaposlenik_id
  24. ,p_c001 => rec.ime
  25. ,p_c002 => rec.prezime
  26. ,p_d001 => rec.datum_rodjenja
  27. ,p_c003 => rec.spol
  28. );
  29. end loop;
  30. end if;
  31.  
  32.  
  33. -- BLOK 2
  34. select seq_id
  35. ,c001 as ime
  36. ,c002 as prezime
  37. ,d001 as datum_rodjenja
  38. ,c003 as spol
  39. into :P13_SEQ_ID
  40. ,:P13_IME
  41. ,:P13_PREZIME
  42. ,:P13_DATUM_RODJENJA
  43. ,:P13_SPOL
  44. from apex_collections
  45. where collection_name = 'ZAPOSLENIK'
  46. and n001 = :P13_ZAPOSLENIK_ID;
  47.  
  48. -- BLOK 3
  49. apex_collection.update_member (
  50. p_collection_name => 'ZAPOSLENIK'
  51. ,p_seq => :P13_SEQ_ID
  52. ,p_c001 => :P13_IME
  53. ,p_c002 => :P13_PREZIME
  54. ,p_d001 => :P13_DATUM_RODJENJA
  55. ,p_c003 => :P13_SPOL
  56. );
  57.  
  58. -- BLOK 4
  59. for rec in (select n001 as zaposlenik_id
  60. ,c001 as ime
  61. ,c002 as prezime
  62. ,d001 as datum_rodjenja
  63. ,c003 as spol
  64. from apex_collections
  65. where collection_name = 'ZAPOSLENIK')
  66. loop
  67. update zaposlenik
  68. set ime = rec.ime
  69. ,prezime = rec.prezime
  70. ,datum_rodjenja = rec.datum_rodjenja
  71. ,spol = rec.spol
  72. where zaposlenik_id = rec.zaposlenik_id;
  73. end loop;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement