帮忙看一下那里不对

wy19280469 2010-01-05 01:42:55
create table db_agent.T_USER_STATISTICS (
u_id NUMBER(9) default NULL not null,
imei VARCHAR(64) not null,
platid NUMBER(6),
mnc CHAR(2) not null,
cityid CHAR(4) not null,
cnt NUMERIC default 0 not null,
time DATE default SYSDATE not null,
isNew CHAR(1) default '0' not null
constraint CKC_ISNEW_T_USER_S check (isNew between '0' and '1' and isNew in ('0','1')),
isMonth CHAR(1) default '0' not null
constraint CKC_ISMONTH_T_USER_S check (isMonth between '0' and '1' and isMonth in ('0','1')),
isYear CHAR(1) default '0' not null
constraint CKC_ISYEAR_T_USER_S check (isYear between '0' and '1' and isYear in ('0','1')),
isPay CHAR(1) default '0' not null,
constraint PK_T_USER_STATISTICS primary key (u_id)
)partition by range (to_days(time))
(
PARTITION p7 VALUES LESS THAN (to_days('2009-08-01')) ,
PARTITION p8 VALUES LESS THAN (to_days('2009-09-01')) ,
PARTITION p9 VALUES LESS THAN (to_days('2009-10-01')) ,
PARTITION p10 VALUES LESS THAN (to_days('2009-11-01')) ,
PARTITION p11 VALUES LESS THAN (to_days('2009-12-01')) ,
PARTITION p12 VALUES LESS THAN (to_days('2010-01-01')) ,
PARTITION p13 VALUES LESS THAN (to_days('2010-02-01')) ,
PARTITION p14 VALUES LESS THAN (to_days('2010-03-01')) ,
PARTITION p15 VALUES LESS THAN (to_days('2010-04-01')) ,
PARTITION p16 VALUES LESS THAN (to_days('2010-05-01')) ,
PARTITION p17 VALUES LESS THAN (to_days('2010-06-01')) ,
PARTITION p18 VALUES LESS THAN (to_days('2010-07-01')) ,
PARTITION p19 VALUES LESS THAN (to_days('2010-08-01')) ,
PARTITION p20 VALUES LESS THAN (to_days('2010-09-01')) ,
PARTITION p21 VALUES LESS THAN (to_days('2010-10-01')) ,
PARTITION p22 VALUES LESS THAN (to_days('2010-11-01')) ,
PARTITION p23 VALUES LESS THAN (to_days('2010-12-01')) ,
PARTITION p48 VALUES LESS THAN MAXVALUE )
tablespace db_agent
/

这样做是按月做的表分区吧??
...全文
103 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangyunzeng2008 2010-01-05
  • 打赏
  • 举报
回复
partition by range (to_days(time)) ,这个地方不对吧!怎么会有to_days函数呢?还有范围分区应该是基于 某个字段不!你这个也不是字段啊!
ojuju10 2010-01-05
  • 打赏
  • 举报
回复
u_id NUMBER(9) default NULL not null,
-----------
默认值为null 字段又设置为not null
inthirties 2010-01-05
  • 打赏
  • 举报
回复
to_days是你自定义的函数么。

语法不对
partition by range (字段名)





laopokanhai 2010-01-05
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 wildwave 的回复:]
Oracle没有自带to_days函数.日期型比较,to_days去掉
partition by range (time)
(
PARTITION p7 VALUES LESS THAN (to_date('2009-08-01','yyyy-mm-dd')) 
.....
[/Quote]

正解
crazylaa 2010-01-05
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 wildwave 的回复:]
Oracle没有自带to_days函数.日期型比较,to_days去掉
partition by range (time)
(
PARTITION p7 VALUES LESS THAN (to_date('2009-08-01','yyyy-mm-dd'))
.....
[/Quote].
小灰狼W 2010-01-05
  • 打赏
  • 举报
回复
Oracle没有自带to_days函数.日期型比较,to_days去掉
partition by range (time)
(
PARTITION p7 VALUES LESS THAN (to_date('2009-08-01','yyyy-mm-dd'))
.....
suiziguo 2010-01-05
  • 打赏
  • 举报
回复
你是什么数据库?MYSQL?
wy19280469 2010-01-05
  • 打赏
  • 举报
回复
错误提示: missing right parenthesis

缺少右括号,在(to_days(time)) 这个位置

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧