我的问题是因为我是新的与oracle和pl/sql可以检查插入期间通过使用自我构造函数的值。 根据另一个属性值检查变量项目的数量的示例?Oracle自身构造函数与if语句
Create or Replace Type test_arr as Varray(20) of number;
Create or Replace Type test_typ as Object(
tID number(5),
tType varchar2(1),
tArray test_arr
);
我想测试时TTYPE =“A”然后tArray.count应小于2,并且如果所述TTYPE =“B”,那么tArray.count应在5和20之间 我想在插入过程中测试如下:
Create Table test_tbl of test_typ;
Insert Into test_tbl Values(187,'A',test_arr(1,6,7)); /*This should give an error and not insert the record as the tType is 'A' and the tArray has 3 values!*/
我不知道我是否可以用自我回报做到这一点。这里最主要的是我需要在插入过程中检查!
我会适当的任何帮助。谢谢!
一个类型构造函数在这里没有帮助。首先,你只能添加构造函数,而不能改变默认构造函数,所以你的自定义验证构造函数必须具有除'(tID,tType,tArray)'以外的签名。其次,在对象表的关系表示中插入“insert”不会调用其类型的构造函数。 –