开发者

How do you perform a PL/SQL custom object type update

开发者 https://www.devze.com 2023-02-04 07:17 出处:网络
I\'m new to PL/SQL coding and I have the following question: I have table Foo: Foo: foo1 numberpk foo2 varchar2

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

0

精彩评论

暂无评论...
验证码 换一张
取 消