Re: PL/SQL Create Object type within a package

From: Jusung Yang <JusungYang_at_yahoo.com>
Date: 17 May 2003 09:46:42 -0700
Message-ID: <130ba93a.0305170846.155ff671_at_posting.google.com>


"Manfred Pruntsch" <manfred.pruntsch_at_ifcos.com> wrote in message news:<ba374b$p5i6h$1_at_ID-51546.news.dfncis.de>...
> Hi all,
>
> I want to have a object type within a package:
>
> CREATE OR REPLACE PACKAGE packageABC AS
>
> create or replace type Point as object (x integer, y integer); -- 1.
> try
>
> -- type Point as object (x integer, y integer); -- 2.try
>
> END packageABC;
>
> I've got this errormessage by the 1. try:
> Error: PLS-00103: Encountered the symbol "CREATE" when expecting one of the
> following:
> end function package pragma private procedure subtype type

> use <an identifier> <a double-quoted delimited-identifier>
> form current cursor
>
> and by the 2. try:
> Error: PLS-00540: object not supported in this context.
> Line: 10 Text: type Point as object (x integer, y integer);
>
> This example runs as standalone without any problems:
> create or replace type Point as object (x integer, y integer)
>
> How do I get this example running in a package? This type is only used by
> the package and it make sense to put all wedgets which belong together in
> the package.
>
> And the next question is: when I have member functions where has to be
> placed the body of the type definition?
>
> regards
> Manfred

Looks like you need to do some PL/SQL reading... You currently can not define an object type within PL/SQL. It must be created and stored in the database. You can do it from PL/SQL with dynamic SQL, but it is a bad idea to do so. Similar to package, when you have member functions, you declare them in the create type statement. The details of the functions should be provided in the type body. Look it up.

  • Jusung Yang
Received on Sat May 17 2003 - 18:46:42 CEST

Original text of this message