SQL> create table t603 (code varchar(10),p_id varchar(7),v1 number(10),v2 number(10));
Table created.
SQL> insert into t603 values('600001','30',1,1);
SQL> insert into t603 values('600001','31',1,1);
SQL> insert into t603 values('600001','10',2,2);
SQL> insert into t603 values('600002','10',3,2);
SQL> insert into t603 values('600002','31',2,1);
SQL> insert into t603 values('600002','30',2,1);
SQL> commit;
Commit complete.
SQL> select * from t603;
CODE P_ID V1 V2
---------- ------- ---------- ----------
600001 30 1 1
600001 31 1 1
600001 10 2 2
600002 10 3 2
600002 31 2 1
600002 30 2 1
6 rows selected.
SELECT code,
p_id, v1
FROM t603
WHERE code IN ('600001','600002')
MODEL RETURN UPDATED ROWS
PARTITION BY (code)
DIMENSION BY (p_id)
MEASURES (v1)
RULES (
v1['err1'] = v1['30'] + v1['31'] -v1['10'])
ORDER BY code, p_id;
--------------------next---------------------
阅读(272) | 评论(0) | 转发(0) |