Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. DROP table high;
  2. DROP table medium;
  3. DROP table low;
  4.  
  5. create table high
  6. ( id number(10) not null,
  7. salary varchar2(50) not null
  8. );
  9. describe high;
  10.  
  11. create table medium
  12. ( id number(10) not null,
  13. salary varchar2(50) not null
  14. );
  15. describe medium;
  16.  
  17. create table low
  18. ( id number(10) not null,
  19. salary varchar2(50) not null
  20. );
  21. describe low;
  22.  
  23.  
  24.  
  25.  
  26.  
  27. create or replace procedure sal
  28. (p_id in employees.employee_id%type,
  29. p_salary out employees.salary%type) is begin
  30. select salary into p_salary from employees where employee_id=p_id;
  31. end sal;
  32. /
  33.  
  34. declare
  35. emp_id employees.employee_id%type;
  36. v_salary employees.salary%type;
  37. begin
  38. emp_id:=&employee_id;
  39. sal(emp_id,v_salary);
  40.  
  41. if v_salary>9000
  42. then
  43. insert into high (id,salary) values (emp_id, v_salary);
  44. elsif v_salary<6000
  45. then
  46. insert into low (id,salary) values (emp_id, v_salary);
  47. else
  48. insert into medium (id,salary) values (emp_id, v_salary);
  49. end if;
  50. end;
  51. /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement