規則也可以是多個維度不同取值
SELECT year
p_id
FROM t
WHERE code IN (
MODEL RETURN UPDATED ROWS
PARTITION BY (code)
DIMENSION BY (p_id
MEASURES (v
RULES (
v
ORDER BY code
YEAR CODE P_ID V
如果年份很多
SQL> insert into t
SELECT year
p_id
FROM t
WHERE code IN (
MODEL RETURN UPDATED ROWS
PARTITION BY (code)
DIMENSION BY (p_id
MEASURES (v
RULES (
v
ORDER BY code
YEAR CODE P_ID V
如果year是數值類型
比如for year in (select year from t
但需要注意不能采用year in 的語法
單個年份的寫法如下:
SELECT year
p_id
FROM t
WHERE code IN (
MODEL RETURN UPDATED ROWS
PARTITION BY (code)
DIMENSION BY (p_id
MEASURES (v
RULES (
v
ORDER BY code
YEAR CODE P_ID V
而
SELECT year
p_id
FROM t
WHERE code IN (
MODEL RETURN UPDATED ROWS
PARTITION BY (code)
DIMENSION BY (p_id
MEASURES (v
RULES (
v
則返回
From:http://tw.wingwit.com/Article/program/Oracle/201311/17047.html