栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

选择语句REF oracle

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

选择语句REF oracle

Create or replace type table1_Type as object ( id integer, dateStart date, etc varchar2(20));-- TYPE TABLE1_TYPE compiledcreate table table1 of table1_type;-- table TABLE1 created.Create or replace type table2_type as object( id integer, items varchar2(30), datePurchased varchar2(20), table1_Ref REF table1_type);-- TYPE TABLE2_TYPE compiledcreate table table2 of table2_type;--table TABLE2 created.INSERT INTO table1 VALUES(table1_Type(1, SYSDATE, 'etc1...'));INSERT INTO table1 VALUES(table1_Type(2, SYSDATE, 'etc2...'));SELECT  REF(t)FROM    table1 tWHERe   id = 1;-- [TST.TABLE1_TYPE]DECLARE    l_table_1_id_1  REF table1_Type;    l_table_1_id_2  REF table1_Type;BEGIN    SELECt  REF(t)    INTO    l_table_1_id_1    FROM    table1 t    WHERe   id = 1;    SELECt  REF(t)    INTO    l_table_1_id_2    FROM    table1 t    WHERe   id = 2;    INSERT INTO table2 VALUES (21, 'item21', SYSDATE, l_table_1_id_1);    INSERT INTO table2 VALUES (22, 'item22', SYSDATE, l_table_1_id_2);END;-- anonymous block completedSELECt COUNT(*) FROM table1;-- 2SELECt COUNT(*) FROM table2;-- 2SELECt * FROM table1;SELECt * FROM table2;SELECt  *FROM    table1 t1JOIN    table2 t2ON      REF(t1) = t2.table1_Ref;


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/634488.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号