How do you perform a PL/SQL custom object type update
I'm new to PL/SQL coding and I have the following question:
I have table Foo:
Foo:
foo1 number pk
foo2 varchar2
foo3 varchar2
foo4 Bar
bar is a custom-array object which holds attributes:
Bar:
bar1 varchar2
bar2 varchar2
bar3 varchar2
开发者_如何学JAVAHow do I write a update statement that updates the foo4?
I can't get the syntax right : /
Not sure if you were trying to do it with an SQL statement and if that is possible at all, but you can do it via PL/SQL, like this (tested on Oracle 10g):
Declare
v_Bar Bar;
Begin
v_Bar := Bar
(
'a',
'b',
'c'
);
--
Update Foo
Set foo4 = v_Bar
Where foo1 = Id;
--
End;
HTH
精彩评论