Results 1 to 9 of 9

Thread: Varrays error

  1. #1
    Contributing Member
    Join Date
    Mar 2008
    Answers
    66

    Varrays error

    I am using Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production.

    While trying to create a table using varrays it is showing errormessage for which I have given details below.


    Create or replace type xx_va as varrays(5) of varchar2(25))

    Type created

    create table xx (name varchar2(25),
    tools xx_va )


    ORA-00902: invalid datatype

    Could someone suggest where the mistake is ?


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Varrays error

    Try using this .

    Create or replace type xx_va as varray(5) of varchar2(25);

    create table xx (name varchar2(25),tools xx_va ) ;

    Use Varray(5) not Varrays(5)


  3. #3
    Contributing Member
    Join Date
    Mar 2008
    Answers
    66

    Re: Varrays error

    Then why without showing error , it has given message type created?

    select * from user_types
    where type_name ='XX_VA'

    not displaying type details. How to see type details or type definition?

    Last edited by babi_geek; 03-19-2008 at 03:39 AM.

  4. #4
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: Varrays error

    use this steps
    CREATE or replace TYPE ttt AS OBJECT (xx_va varchar2(25));

    CREATE or replace TYPE xx_va AS VARRAY(5) OF ttt;

    create table xx (name varchar(25),
    tools xx_va)


    Quote Originally Posted by babi_geek View Post
    I am using Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production.

    While trying to create a table using varrays it is showing errormessage for which I have given details below.


    Create or replace type xx_va as varrays(5) of varchar2(25))

    Type created

    create table xx (name varchar2(25),
    tools xx_va )


    ORA-00902: invalid datatype

    Could someone suggest where the mistake is ?



  5. #5
    Contributing Member
    Join Date
    Mar 2008
    Answers
    66

    Re: Varrays error

    select * from user_types
    where type_name ='XX_VA'

    not displaying type details. How to see type details or type definition?


  6. #6
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Varrays error

    Quote Originally Posted by babi_geek View Post
    Then why without showing error , it has given message type created?

    If your syntax is wrong , oracle compiler will never say that is correct.
    Quote Originally Posted by babi_geek View Post
    select * from user_types
    where type_name ='XX_VA'

    not displaying type details. How to see type details or type definition?
    That is because your type was never compiled successfully because of the syntax error in your code .


  7. #7
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: Varrays error

    Quote Originally Posted by babi_geek View Post
    select * from user_types
    where type_name ='XX_VA'

    not displaying type details. How to see type details or type definition?

    use this
    select * from user_source where type='TYPE' and name='XX_VA'


  8. #8
    Contributing Member
    Join Date
    Mar 2008
    Answers
    66

    Re: Varrays error

    I insert a record
    insert into xx values('babi', xx_va('Ax','Screw Driver'));

    Then I have given the following command
    select * from xx

    Output is

    babi xx_vA()


    Can we see the complete details of XX_VA() without writing a Pl/Sql Code?

    Last edited by babi_geek; 03-19-2008 at 04:21 AM.

  9. #9
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: Varrays error

    Quote Originally Posted by babi_geek View Post
    I insert a record
    insert into xx values('babi', xx_va('Ax','Screw Driver'));

    Then I have given the following command
    select * from xx

    Output is

    babi xx_vA()


    Can we see the complete details of XX_VA() without writing a Pl/Sql Code?


    You may also use USER_COLL_TYPES instead of user_source.

    I think in Varrays we need to querying data Via Pl/Sql instead of SQL Extensions.

    To access data using SQL use nested tables instead of varrays.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact