Home » SQL & PL/SQL » SQL & PL/SQL » creating an object type on the database
creating an object type on the database [message #10646] Fri, 06 February 2004 12:29 Go to next message
Paul Bankston
Messages: 12
Registered: February 2004
Junior Member
I am trying to create a table of records object type on the database.  Here is the syntax:

CREATE OR REPLACE TYPE tTableType IS TABLE OF mms_old_owner.MmsActivity%ROWTYPE INDEX BY BINARY_INTEGER;

The command runs and the object is created but when I try to use it I get the following:

PLS-00905: object BANKSTONP.TTABLETYPE is invalid

 
Re: creating an object type on the database [message #10648 is a reply to message #10646] Fri, 06 February 2004 13:16 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
A nested collection can only use a predefined SQL type, so the %rowtype is not valid in this context. Also, the SQL type would be a collection and would not use the INDEX BY clause (only used with PL/SQL associative arrays).

You could create a type that reflects the columns of the table:

create or replace type emprow as object (empno number, ename varchar2(30));


Note: You cannot use %type in these definitions.

And then create a collection based on this type:

create or replace type ttabletype1 is table of emprow;
Previous Topic: simple select
Next Topic: HowTo connect to a WebService
Goto Forum:
  


Current Time: Wed Apr 24 20:56:33 CDT 2024