Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: object programming in sql
It is not as so simply as Daniel thinks !
in fact i've tried to do this but there is a BIG problem, and today nobody seems to have a solution (on OTN somebody said that it would be include in a future release !!! ;-)
Here is the code :
create or replace TYPE TYPE_A as object
(
value_ NUMBER,
MEMBER FUNCTION setValue(v_value NUMBER) RETURN TYPE_A
) INSTANTIABLE NOT FINAL;
/
create or replace TYPE BODY TYPE_A IS
member function setValue(v_value NUMBER) RETURN TYPE_A IS
v_inst TYPE_A := SELF;
v_old_inst TYPE_A := SELF;
begin
if v_old_inst.value_ != v_value then
v_inst.value_ := v_value;
dbms_output.put_line('setValue executed');
end if;
return v_inst;
end;
END;
/
create table TEST (ATTR_ TYPE_A);
insert into TEST values(TYPE_A(55));
BUT the update command below writes "setValue executed" 3 times on screen, why !!?? : so the setValue was executed 3 times, in fact we've got just one attribute !! what's wrong with OO in Oracle ?????
UPDATE TEST a set ATTR_ = a.ATTR_.setValue(56);
"%FULLUSERNAME%" <ademidem_at_lisisun1.insa-lyon.fr> wrote in message news:b3v7fp$4ct$1_at_demo2.univ-lyon1.fr...
| hello everybody out there,
|
| i've made a table of an object "test" with one field "val" an integer, and i
| want to update a record with the procedure "setValue" i created myself, is
| there any means to do so ?!!
| something like "update mytable m set m.setValue(xxx)" or something like this
| !
|
| thanx
|
|
Received on Thu Mar 06 2003 - 08:41:53 CST
![]() |
![]() |