Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE FUNCTION FUNCTION1 (broj IN NUMBER) RETURN VARCHAR AS
- tekst VARCHAR2(200);
- CURSOR c1 IS
- SELECT DISTINCT department_name, max_salary, job_title
- FROM departments, employees, jobs
- WHERE departments.department_id=employees.department_id
- AND employees.job_id=jobs.job_id
- AND departments.department_id=broj
- ORDER BY max_salary DESC;
- ime departments.department_name%type;
- plata jobs.max_salary%type;
- posao jobs.job_title%type;
- pomocna VARCHAR(200):=null;
- BEGIN
- OPEN c1;
- LOOP
- EXIT WHEN c1%notfound;
- FETCH c1
- INTO ime, plata, posao;
- pomocna :='Department: '||ime||'Plata: '||TO_CHAR(plata)||'Posao: '||posao || pomocna;
- END LOOP;
- CLOSE c1;
- tekst:=pomocna;
- RETURN tekst;
- END FUNCTION1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement