2

I have a procedure that creates and declares different types. But every time I write 'create type' or 'declare type' I get this error:

ERROR line 4, col 10, ending_line 4, ending_col 18, Found 'recipient', Expecting: ( . @ or % or .. := DEFAULT NOT NULL or ;

I use Oracle 10 and these are the first lines of the procedure. The error

CREATE OR REPLACE PROCEDURE ACTIVITE_PROD.NOTIF_NEW_HOLIDAY(v_USER_ID INTEGER,     v_DURATION NUMBER, v_WEEK INTEGER, v_YEAR INTEGER) IS

-- this line causes the error
create type recipient as object (firstname varchar2, lastname varchar2, email varchar2);

-- this line also causes an error if modified and set first
declare
    type recipients_list is table of recipient;

    admins recipients_list := recipients_list();

What is wrong with my code?

1 Answer 1

7

From the Oracle Documentation Using PL/SQL With Object Types

Currently, you cannot define object types in a PL/SQL block, subprogram, or package. You can define them interactively in SQL*Plus using the SQL statement CREATE TYPE.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.