Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: HELP! object relational
"Kathrin Holweger" <kaholli_at_web.de> wrote in message
news:3b2b4297$1_at_netnews.web.de...
> Hi,
>
>
> In a lecture we got the following code as an example how object
> relational stuff works with oracle and we're supposed to do an
> assignment according to this. unfortunately the code doesn't compile
> and I couldn't find what's wrong with it anywhere. Maybe anyone here
> can help me out finding what's missing there?
>
>
>
> create type point_t as object(
> x number,
> y number);/
>
>
> create type line_t as object(
> end1 point_t,
> end2 point_t);/
>
>
> alter type line_t replace as object(
> end1 point_t,
> end2 point_t,
> member function linelength (scale in number)
> return number,
> pragma restrict_references (linelength, wnds));/
>
>
> ****Up to this point it works. now comes the stuff that won't compile****
>
>
>
> create type body line_t as
> member function linelength(scale number) return
> number is
> begin
> return
> scale *
> sqrt((self.end1.x - self.end2.x)
> * (self.end1.x - self.end2.x)
> + (self.end1.y - self.end2.y)
> * (self.end1.y - self.end2.y));
> end;
> end;/
>
>
> I really hope someone can help me out!
>
>
> Thanks, Holli
>
> --
> __________________________________________________________
> News suchen, lesen, schreiben mit http://newsgroups.web.de
Please try to be less lazy and more specific
Here's what I got (and normally I don't even bother to do this)
SQL> set termout on echo on SQL> @holli SQL> create type point_t as object(
Type created.
SQL> SQL> SQL> create type line_t as object(
Type created.
SQL> SQL> SQL> alter type line_t replace as object(2 end1 point_t,
Type altered.
SQL> / Type altered.
SQL> SQL> SQL> rem ****Up to this point it works. now comes the stuff that won'tcompile****
SQL> SQL> SQL> SQL> create type body line_t as
6 scale * 7 sqrt((self.end1.x - self.end2.x) 8 * (self.end1.x - self.end2.x) 9 + (self.end1.y - self.end2.y) 10 * (self.end1.y - self.end2.y));11 end;
Type body created.
SQL>
SQL> spool off
This is Personal Oracle 8.1.5
So what is your error again? Received on Sat Jul 21 2001 - 16:22:25 CDT