Home » RDBMS Server » Server Administration » partition-key using function issue (11g windows)
partition-key using function issue [message #520011] Thu, 18 August 2011 03:20 Go to next message
andy huang
Messages: 498
Registered: July 2011
Senior Member
Dear all,
It can not use function in partition-key, right?

create table tb_hxl_user_rh
(
  statedate number(8),
  provcode number not null,
  usernumber varchar2(13) not Null
)
partition by range (statedate)
(
  partition HXL_USER_20110516 values less than 
(to_number(to_char(TO_DATE('2011-05-17 00:00:00', 'YYYY-MM-DD HH24:MI:SS'),'YYYYMMDD')))
);

ORA-14019: partition bound element must be one of: string, datetime or interval
literal, number, or MAXVALUE

[Updated on: Thu, 18 August 2011 04:03] by Moderator

Report message to a moderator

Re: partition-key using function issue [message #520016 is a reply to message #520011] Thu, 18 August 2011 03:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What is the purpose of all these TO... when you already know the answer when you type it: 20110517?

Regards
Michel
Re: partition-key using function issue [message #520019 is a reply to message #520016] Thu, 18 August 2011 03:59 Go to previous messageGo to next message
andy huang
Messages: 498
Registered: July 2011
Senior Member
hi,
The STATEDATE column is number type defined by user,but user really want it to representate DATE,so I need to change date to number.
If i do not do this,the STATEDATE can store values such as 20110532, it is not a valid date.
Re: partition-key using function issue [message #520020 is a reply to message #520019] Thu, 18 August 2011 04:02 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So change the statedate datatype.

In addition, when you create the partition you KNOW what is the value you put in the limit so you know if it is a valid date or not.

Regards
Michel
Re: partition-key using function issue [message #520025 is a reply to message #520020] Thu, 18 August 2011 04:09 Go to previous messageGo to next message
andy huang
Messages: 498
Registered: July 2011
Senior Member
I do know why oracle does not support function in partition-key.
Re: partition-key using function issue [message #520028 is a reply to message #520025] Thu, 18 August 2011 04:17 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
There is nothing to understand, just admit it, and I repeat "what should be the usage of this?".

Regards
Michel
Re: partition-key using function issue [message #520040 is a reply to message #520025] Thu, 18 August 2011 04:51 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
You need to upgrade to 11g, then you can partition on a virtual column with a function:
orcl> create table parts(c1 varchar2(10), c1upper as (upper(c1)))
  2  partition by range (c1upper)
  3  (partition p1 values less than ('A'),
  4  partition p2 values less than ('B'));

Table created.

orcl>
Re: partition-key using function issue [message #520046 is a reply to message #520040] Thu, 18 August 2011 05:04 Go to previous messageGo to next message
andy huang
Messages: 498
Registered: July 2011
Senior Member
Good!
Re: partition-key using function issue [message #520047 is a reply to message #520046] Thu, 18 August 2011 05:16 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Good? I don't see how it answers the question to put some function inside "value less than" clause.

Regards
Michel
Previous Topic: how can i add a subpartition
Next Topic: How much flash recovery area is enough for flashback
Goto Forum:
  


Current Time: Thu Apr 25 08:56:42 CDT 2024