Advertisement
Guest User

Untitled

a guest
May 26th, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. CREATE OR REPLACE FUNCTION FUNCTION1 (broj IN NUMBER) RETURN VARCHAR AS
  2. tekst VARCHAR2(200);
  3.  
  4. CURSOR c1 IS
  5. SELECT DISTINCT department_name, max_salary, job_title
  6. FROM departments, employees, jobs
  7. WHERE departments.department_id=employees.department_id
  8. AND employees.job_id=jobs.job_id
  9. AND departments.department_id=broj
  10. ORDER BY max_salary DESC;
  11.  
  12. ime departments.department_name%type;
  13. plata jobs.max_salary%type;
  14. posao jobs.job_title%type;
  15. pomocna VARCHAR(200):=null;
  16.  
  17.  
  18. BEGIN
  19.  
  20. OPEN c1;
  21. LOOP
  22. EXIT WHEN c1%notfound;
  23. FETCH c1
  24. INTO ime, plata, posao;
  25. pomocna :='Department: '||ime||'Plata: '||TO_CHAR(plata)||'Posao: '||posao || pomocna;
  26. END LOOP;
  27. CLOSE c1;
  28. tekst:=pomocna;
  29. RETURN tekst;
  30. END FUNCTION1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement