Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. set serveroutput on
  2. DECLARE
  3. message varchar2(32767);
  4. BEGIN
  5. for msg in (
  6. select COURSE.COURSE_ID as "Code",
  7. COURSE_NAME as "Name",
  8. C_SEC_ID as "Sec",
  9. F_ID as "Fac"
  10. into
  11. V_COURSE_id,
  12. V_COURSE_NAME,
  13. V_C_SEC_id,
  14. V_F_ID
  15. from COURSE_SECTION join COURSE
  16. on COURSE_SECTION.COURSE_ID = COURSE.COURSE_ID
  17. ) loop
  18. message:=msg.code || ', ' || msg.name || ', ' || msg.sec || ', ' || msg.fac;
  19. dbms_output.put_line(message);
  20. end loop;
  21. EXCEPTION
  22. when NO_DATA_FOUND then
  23. DBMS_OUTPUT.PUT_LINE('There is no data!');
  24. when others then
  25. error_message := SQLERRM;
  26. DBMS_OUTPUT.PUT_LINE('This program encountered the following error: ');
  27. DBMS_OUTPUT.PUT_LINE(error_message);
  28. END;
  29. /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement