Skip to main content

Partitioning table on year and week of the year

  • January 28, 2016
  • 2 replies
  • 19 views

Hdk
  • Participating Frequently

alter table TABLE_NAME partition by EXTRACT(YEAR FROM to_timestamp(CC)); ROLLBACK 2552: Cannot use meta function or non-deterministic function in PARTITION BY expression alter table TABLE_NAME partition by date_part('YEAR',to_timestamp(CC)); ROLLBACK 2552: Cannot use meta function or non-deterministic function in PARTITION BY expression

Data in CC column is like 1441650600 EPOCH time

Does anyone knowsthe reason?

2 replies

eli_revach
Forum|alt.badge.img+2
  • Participating Frequently
  • January 28, 2016

Hi ,

This should work for you :

 


alter table TABLE_NAME partition by ( (date_part('year', TIMESTAMPADD('ss',CC,TIMESTAMP 'epoch' )) * 100) + date_part('week', TIMESTAMPADD('ss',CC,TIMESTAMP 'epoch' )));

 

I hope you will find it useful 

 

Thanks .


Hdk
  • Author
  • Participating Frequently
  • January 29, 2016

Thank you so much . It worked as expected.