Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Object Type Error

Re: Object Type Error

From: Andy Hardy <junkmail_at_[127.0.0.1>
Date: Tue, 1 Apr 2003 22:23:20 +0100
Message-ID: <0UrYv7BINgi+Ew23@hardyfamily.plus.com>


In message <b6c72k$3kn0m$1_at_ID-110726.news.dfncis.de> , "Chris ( Val )" <chrisval_at_bigpond.com.au> writes
>
>"Ed Prochak" <edprochak_at_adelphia.net> wrote in message
>news:3E847FFF.1060607_at_adelphia.net...
>| Chris ( Val ) wrote:
>| > "Chris ( Val )" <chrisval_at_bigpond.com.au> wrote in message
>| > news:b5k1a4$29c3fl$1_at_ID-110726.news.dfncis.de...
>| > | Hi everyone.
>| > |
>| > | I'm not sure if this is allowed, but here is what I'm
>| > | trying to do.
>| > |
>| > | I can create an object type like so:
>| > |
>| > |
>| > | CREATE OR REPLACE TYPE MyType AS OBJECT
>| > | (
>| > | fname VARCHAR2( 30 ),
>| > | lname VARCHAR2( 30 ),
>| > | age NUMBER( 3 )
>| > | );
>| > |
>| > |
>| > | But when I try to create it using the '%TYPE', I
>| > | get the error listed below(after typing show errors),
>| > | but I'm not sure why.
>| > |
>| > |
>| > | CREATE OR REPLACE TYPE MyType AS OBJECT
>| > | (
>| > | fname MyTable.FirstName%TYPE,
>| > | lname MyTable.LastName%TYPE,
>| > | age MyTable.Age%TYPE
>| > | );
>| > |
>| > | Errors for TYPE MYTYPE:
>| > |
>| > | LINE/COL ERROR
>| > | -------- ----------------------------------------------------------
>| > | 0/0 PL/SQL: Compilation unit analysis terminated
>| > | 3/9 PLS-00201: identifier 'MYTABLE.FIRSTNAME' must be declared

>I am using: Oracle 9i Personnel edition on a W2K Pro box.
>
>A person told me during the week that it was not legal to use
>'%TYPE' in this situation, and this is what I'm not sure about.
>
>Could this be the case ?.

True, you can't use the %TYPE notation when referring to objects.

They are 'static' things that cannot change during their life (other than be dropped or replaced). If you were to use %TYPE, then you might change the table column definition on which it was based - at which point you'd then expect all instances of that object (including those stored in tables themselves) to change to match.

Andy

-- 
Andy Hardy. PGP ID: 0xA62A4849
Received on Tue Apr 01 2003 - 15:23:20 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US