Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. procedure ADD_PROJTYPE_PP (
  2. p_project_ID IN INTEGER,
  3. p_projType IN VARCHAR
  4. )
  5. is
  6.  
  7. ex_error EXCEPTION;
  8. err_msg_txt VARCHAR(100) := NULL;
  9. count_ID number;
  10. count_Type number;
  11.  
  12.  
  13.  
  14. begin
  15.  
  16. if p_project_id is null then
  17. err_msg_txt := 'the project id is null and it cannot be null';
  18. Raise ex_error;
  19.  
  20. select count (project_id) into count_id
  21. from I_project
  22. where project_id = p_project_id;
  23. elsif count_id < 1 then
  24. err_msg_txt := ' the project id does not exists';
  25. Raise ex_error;
  26.  
  27. end if;
  28.  
  29.  
  30. if p_projType is null then
  31. err_msg_txt := 'the project type is null and it cannot be null';
  32. Raise ex_error;
  33.  
  34. select count (project_type_name) into count_type
  35. from I_PROJECT_TYPE
  36. where project_type_name = p_projType;
  37. elsif count_type < 1 then
  38. err_msg_txt := ' the project type does not exists';
  39. Raise ex_error;
  40.  
  41. end if;
  42.  
  43. Commit;
  44.  
  45. Exception
  46. when ex_error then
  47. dbms_output.put_line(err_msg_txt);
  48. rollback;
  49. when others then
  50. dbms_output.put_line(' the error code is: ' || sqlcode);
  51. dbms_output.put_line(' the error msg is: ' || sqlerrm);
  52. rollback;
  53.  
  54. end ADD_PROJTYPE_PP;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement