Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Script error? Need help

Script error? Need help

From: Solidnull, Inc. <andrew_at_solidnull.com>
Date: Tue, 6 Nov 2001 18:40:40 -0000
Message-ID: <3be83dff$1@motown>


I do have a question regarding the following script; it does give me this error as this expression is of wrong type when i try and create type body for my data type???
Any advice what kind of problem i am facing and any solutions?

/* bof create type: tp_pipe */

create or replace type tp_pipe as object (fld_x number, fld_y number,
member function func_coordinate return number, pragma restrict_references(func_coordinate,WNDS,WNPS,RNPS,RNDS),

static function func_intersect(fld_pipe1 tp_pipe,fld_pipe2 tp_pipe) return number,
pragma restrict_references(func_intersect,WNDS,WNPS,RNPS,RNDS) );
/

/* eof create type: tp_pipe */
/* bof create type body: tp_pipe */

create or replace type body tp_pipe as
member function func_coordinate return number is result number;
begin
 result:= 'fld_x' || to_char(fld_x) || 'fld_y' || to_char(fld_y);  return result;
end;
static function func_intersect(fld_pipe1 tp_pipe,fld_pipe2 tp_pipe) return number is

    xc number;
    yc number;
    r1 number;
    s1 number;
    t1 number;
    t2 number;
    r2 number;
    s2 number;

    xOn long;
    yOn long;
    x1 number;
    x2 number;
    y1 number;
    y2 number;
    y4 number;
    y3 number;
    x3 number;
    x4 number;

begin
--x1:=self.fld_x;
--x2:=self.fld_x;
--x3:=self.fld_x;
--x4:=self.fld_x;
--y1:=self.fld_y;
--y2:=self.fld_y;
--y3:=self.fld_y;
--y4:=self.fld_y;
r1:= (y2 - y1); r2:= (y4 - y3);
s1:= -(x2 - x1); s2:= -(x4 - x3);
t1:= (x2 * y1) - (x1 * y2); t2:= (x4 * y3) - (x3 * y4);

xc:= ((s1 * t2) - (s2 * t1)) / ((s2 * r1) - (s1 * r2)); yc:= ((t1 * r2) - (t2 * r1)) / ((s2 * r1) - (s1 * r2));

xOn:= ((xc >= Least(x1,x2)) and (xc <= Greatest(x1,x2)) and (xc >= Least(x3,x4)) and (xc <= Greatest(x3,x4))); yOn:= ((yc >= Least(y1,y2)) and (yc <= Greatest(y1,y2)) and (yc >= Least(x3,x4)) and (yc <= Greatest(x3,x4)));

if (xOn and yOn) then
return xc;
else
return null;
end if;
end;
end;
/

/* eof create type body: tp_pipe */
/* bof create a table: tbl_pipe */

create table tbl_pipe(fld_id char(2) not null, fld_jointid char(2) not null, fld_pipe tp_pipe not null);

/* eof create a table: tbl_pipe */ Received on Tue Nov 06 2001 - 12:40:40 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US