Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

can we put anchoring declaration inside a create type statement?

715920Dec 18 2011 — edited Dec 18 2011
Dear all,
is it possible to put anchoring declaration inside create type statement? Suppose I want to declare the following type in the schema level:
SQL> create or replace type f_name_list_type is table of employees.first_name%ty
pe;
  2  /

Warning: Type created with compilation errors.

SQL> SHO ERR
Errors for TYPE F_NAME_LIST_TYPE:

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      PL/SQL: Compilation unit analysis terminated
1/35     PLS-00201: identifier 'EMPLOYEES.FIRST_NAME' must be declared
SQL> desc employees
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------

 EMPLOYEE_ID                                        NUMBER(6)
 FIRST_NAME                                         VARCHAR2(20)
 LAST_NAME                                 NOT NULL VARCHAR2(25)
 EMAIL                                     NOT NULL VARCHAR2(25)
 PHONE_NUMBER                                       VARCHAR2(20)
 HIRE_DATE                                 NOT NULL DATE
 JOB_ID                                    NOT NULL VARCHAR2(10)
 SALARY                                             NUMBER(8,2)
 COMMISSION_PCT                                     NUMBER(2,2)
 MANAGER_ID                                         NUMBER(6)
 DEPARTMENT_ID                                      NUMBER(4)
What's wrong with the code above? The error complains about employees.first_name doesn't exist but, clearly it's showing in the schema.

Regards,
Val
This post has been answered by John Spencer on Dec 18 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2012
Added on Dec 18 2011
4 comments
426 views