Below is the code which I've used to store the values in a varray and finally return the varray. But I'm encountering an error at line 12 saying "Line/Col: 12/8 PLS-00103: Encountered the symbol "EMP_TYPE" when expecting one of the following: := . ( @ % ;" What improvements do I need to make?
create or replace type emp_type AS VARRAY(25) OF VARCHAR(10);
/
create or replace function emp_sal
return emp_type
is
emp emp_type := emp_type();
l_salary number(10);
maxim number(10);
minim number(10);
BEGIN
SELECT sum(salary) INTO l_salary FROM Employee8_43;
SELECT max(salary) INTO maxim FROM Employee8_43;
SELECT min(salary) INTO minim FROM Employee8_43;
emp emp_type := emp_type(l_salary,maxim,minim);
return emp;
END;
You're quite close; shame you didn't read what Oracle has told you.
It tells literally everything you need to know: line number, column number, and what it found but expected something else.
This:
should be
So: