<div id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New',courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New',monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px">------------------------抽象数据类型---------<span style="color: #008000">--@H_301_1@
方法@H_301_1@
replace type address (@H_301_1@
属性@H_301_1@
属性@H_301_1@
final; -- final表示该类型可以有子类型@H_301_1@
301_1@
301_1@
address说明这个类型继承至address类型@H_301_1@
replace type detailAddress address (@H_301_1@
属性 第3个成员@H_301_1@
301_1@
301_1@
empInfo@H_301_1@
empInfo (@H_301_1@
301_1@
(2),--性别@H_301_1@
,--年龄@H_301_1@
301_1@
301_1@
301_1@
增加数据,只能用构造方法@H_301_1@
empInfo (,,28,detailAddress(,,));@H_301_1@
empInfo (,26,,));@H_301_1@
empInfo (,,29,));@H_301_1@
查询@H_301_1@
* empInfo;@H_301_1@
* empInfo eSex = ;@H_301_1@
* empInfo e e.eAddress.city = ; --如果查询条件包含属性必须用表的别名@H_301_1@
301_1@
301_1@
empInfo e e.eAddress = detailAddress(,) e.eName = ;@H_301_1@
301_1@
empInfo e e.eAddress.city = e.eName = ;@H_301_1@
删除@H_301_1@
empInfo e e.eAddress.city = ;@H_301_1@
属性建立索引@H_301_1@
idxemp empInfo(eAddress.city);@H_301_1@
删除@H_301_1@
empInfo;@H_301_1@
type address force; --强制删除抽象类型@H_301_1@
@H_301_1@
@H_301_1@
@H_301_1@
replace type person (@H_301_1@
301_1@
(2),--性别@H_301_1@
--年龄@H_301_1@
final;@H_301_1@
301_1@
@H_301_1@
replace type student person (@H_301_1@
@H_301_1@
301_1@
stuInfo student;@H_301_1@
301_1@
stuInfo pk_stuInfo (stuId);@H_301_1@
301_1@
stuInfo (,1001);@H_301_1@
方法@H_301_1@
stuInfo (student(,1002));@H_301_1@
stuInfo (student(,1003));@H_301_1@
查询,当普通表用@H_301_1@
* stuInfo stuId = 1002;@H_301_1@
删除都用普通的sql语句即可@H_301_1@
stuInfo pAge = 29 pName = ;@H_301_1@
stuInfo stuId = 1001;@H_301_1@
;@H_301_1@
(表别名)函数用来返回对象的OID,也就是对象标识符,对象表也有rowid@H_301_1@
(s) stuInfo s;@H_301_1@
rowid,(s) OIDS stuInfo s;@H_301_1@
301_1@
stuscore (@H_301_1@
student,--stu这一列的值必须出现在stuInfo表中,且stu这一列存的对象的OID而不是对象本身@H_301_1@
score --分数@H_301_1@
301_1@
301_1@
错误的做法:insert stuscore ( (s) stuInfo stuId = 1001,90)@H_301_1@
301_1@
stuscore (s),90 stuInfo s stuId = 1001;@H_301_1@
stuInfo s; --插入3行数据@H_301_1@
stuInfo s stuId = 1003;@H_301_1@
* stuscore;@H_301_1@
(列名)函数可以把OID还原为对象,主键列显示有问题@H_301_1@
(s.stu),score stuscore s s.stu.stuId = 1001;@H_301_1@
修改,以下2个都可以@H_301_1@
stuscore score=100 stu = ( (s) stuInfo s stuId = 1001);@H_301_1@
stuscore s score = 99 s.stu.stuId = 1001;@H_301_1@
删除,以下3个都可以@H_301_1@
stuscore stu = ( (s) stuInfo s stuId = 1001);@H_301_1@
stuscore s s.stu.stuId = 1001;@H_301_1@
stuscore stuId = 1001;@H_301_1@
@H_301_1@
@H_301_1@
@H_301_1@
301_1@
301_1@
aaa@H_301_1@
);@H_301_1@
type aaaa @H_301_1@
replace view_stu aaaa oid(a)@H_301_1@
@H_301_1@
* aaa;@H_301_1@
* view_stu;@H_301_1@
301_1@
@H_301_1@
方法-----------@H_301_1@
@H_301_1@
301_1@
301_1@
get_pro varchar2,--函数,后面接,而不是;@H_301_1@
get_city varchar2,@H_301_1@
set_pro(pro varchar2),--过程@H_301_1@
set_city(cy varchar2)@H_301_1@
replace type body ADDRESS--后面不能加 @H_301_1@
--后面不能加begin@H_301_1@
301_1@
get_pro varchar2@H_301_1@
@H_301_1@
@H_301_1@
province;@H_301_1@
get_pro;@H_301_1@
get_city varchar2@H_