0

i have the following code for table value Function in oracle 12c on windows8 as following

 CREATE TABLE MisJob
   ( ID RAW(16), 
 JobTitle VARCHAR2(35 BYTE), 
 MinSalary NUMBER(6,0), 
 MaxSalary NUMBER(6,0),
  PRIMARY KEY (ID)
 )


CREATE TYPE MISJOBType AS OBJECT ( JobTitle VARCHAR2(35 BYTE), MinSalary NUMBER(6,0),MaxSalary NUMBER(6,0));

CREATE TYPE MISJOBTypeCol AS TABLE OF MISJOBType;

CREATE OR REPLACE FUNCTION fEmployee (jobid IN RAW(16))
RETURN MISJOBTypeCol PIPELINED IS
BEGIN 
  FOR i IN (SELECT *  FROM MisJob)LOOP
  PIPE ROW(MISJOBType(i.JobTitle, i.MinSalary,i.MaxSalary));
  END LOOP;
  RETURN;
END;    

but i am getting the error Error(2,13): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.

and i don't know why even though i have followed this example Table-Valued Functions in ORACLE 11g ? ( parameterized views )

what is wrong

Community
  • 1
  • 1
oula alshiekh
  • 843
  • 5
  • 14
  • 40

1 Answers1

1

Remove the size constraint on the formal argument:

CREATE OR REPLACE FUNCTION fEmployee (jobid IN RAW)
...

From the documentation:

... you cannot include a constraint in a formal parameter declaration

Alex Poole
  • 183,384
  • 11
  • 179
  • 318