首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 數據庫知識 >  >> Oracle 資料庫 >> Oracle 資料庫基礎

Oracle 9i 巢狀表資料操作:插入與修改

     編輯:Oracle 資料庫基礎

建立巢狀表結構

create table test(
  a varchar2(10),
  b nested_tab_test
) nested table b store as test1;

插入資料步驟

  1. 先插入空的巢狀表實例
    insert into test(a,b) values('aaa', nested_tab_test());
  2. 向巢狀表插入具體值
    insert into table (select b from test where a='aaa') values('a01');
  3. 從其他表查詢並轉型插入
    insert into test
    select 'aaa', cast(multiset(select a from test2) as nested_tab_test)
    from dual;

關鍵點

核心在於掌握 **插入巢狀表對應的型別物件**,使用 cast(multiset(...)) 將查詢結果轉型為巢狀表型別。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved