Redian新闻
>
PL/SQL constraint 求教?
avatar
PL/SQL constraint 求教?# Database - 数据库
f*e
1
现在我有type point and type line, table polygons(多边形)如下:
create or replace type Point as object(
X float,
Y float
);
/
create or replace type Line as object(
SP point, -- start point
EP point -- end point
);
/
create or replace type LineTableType as
table of Line;
/
create table Polygons(
PID integer,
Lines LineTableType
)
nested table Lines store as LinesTable;
ÏÖÔÚ因为所有µÄµã¶¼&
Ocirc;ÚµÚ1象限&pound
avatar
n*a
2
Check constraint can only be enforced on a table.
And you can define constraints on the leaf-level scalar attributes of a column
object.
However, in your case, Polygons.Lines is a table collection of objects.
I don't think you declare a simple check constraint.
Use trigger to iterate each member of Polygons.Lines and check for error
conditions
create or replace trigger trig_polygons
after insert or update on Polygons
for each row
begin
for i in 1..:new.Lines.count loop
if :new.Lines(i).SP.

【在 f***e 的大作中提到】
: 现在我有type point and type line, table polygons(多边形)如下:
: create or replace type Point as object(
: X float,
: Y float
: );
: /
: create or replace type Line as object(
: SP point, -- start point
: EP point -- end point
: );

avatar
f*e
3
thank you so much!

column

【在 n********a 的大作中提到】
: Check constraint can only be enforced on a table.
: And you can define constraints on the leaf-level scalar attributes of a column
: object.
: However, in your case, Polygons.Lines is a table collection of objects.
: I don't think you declare a simple check constraint.
: Use trigger to iterate each member of Polygons.Lines and check for error
: conditions
: create or replace trigger trig_polygons
: after insert or update on Polygons
: for each row

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。