Link to home
Create AccountLog in
Avatar of toooki
toooki

asked on

Oracle partition table question

I want to create a partitioned (LIST or something else?) table t1 (in Oracle 11gR2)  that will store records in partions based on the value of f2 . But the partition values (t2.p2) are decided by another static table t2 with this t1.f2 = t2.p1 condition.

Could you let me know how to create the table (partition value is not a field value of the table)?

CREATE TABLE t1(
  f1 Integer,
  f2 Integer)
TABLESPACE my_tbs partition by LIST (f2)
(PARTITION P_1 VALUES (1)) ;

t1:
f1   f2
=======
1    45678
2    45666
3    67899
4    66677

t2:
p1    p2
=========
45678 20121111
45666 20121104
67899 20121118
66677 20121125


t1:
f1   f2
=======
1    45678 (in partition P_20121111 and value 20121111)
2    45666 (in partition P_20121104 and value 20121104)
3    67899 (in partition P_20121118 and value 20121118)
4    66677 (in partition P_20121125 and value 20121125)
ASKER CERTIFIED SOLUTION
Avatar of Helena Marková
Helena Marková
Flag of Slovakia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of toooki
toooki

ASKER

Thank you.