Home » SQL & PL/SQL » SQL & PL/SQL » Question on Object
Question on Object [message #241251] Tue, 29 May 2007 00:11 Go to next message
vishal gupta
Messages: 111
Registered: March 2001
Senior Member
Hi,
I have a simple question.
Why is this not allowed in Oracle ?

Create or replace type test as Object(
emp_name emp.empname%type);

I am using oracle 9i .

regards
Re: Question on Object [message #241268 is a reply to message #241251] Tue, 29 May 2007 01:11 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Because "create type" is a SQL statement and %TYPE is a PL/SQL thing that you can't use in SQL.

Regards
Michel
Re: Question on Object [message #241273 is a reply to message #241251] Tue, 29 May 2007 01:29 Go to previous messageGo to next message
vishal gupta
Messages: 111
Registered: March 2001
Senior Member
Thanks Michel.
i understood what you are saying.
But,is there any workaround for this?
actually,we are going to create a lot of Objects types
and want the columns to correspond to the actual table columns so that if there is any change in table structure,the object types need not be changed.

regds.
Re: Question on Object [message #241281 is a reply to message #241273] Tue, 29 May 2007 01:47 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No workaround.
You can generate the object with a script that catches the definition in the dictionary but you still have to recreate the object each time you change the table definition.

Regards
Michel
Previous Topic: Get ddl from Oracle8
Next Topic: query on update
Goto Forum:
  


Current Time: Sat Dec 10 11:15:24 CST 2016

Total time taken to generate the page: 0.18930 seconds