oracle中序列的问题

来源:百度知道 编辑:UC知道 时间:2024/06/23 23:39:16
create table testtable ( "id" sequence.nextval , "name" varchar2(10) )
*

第 1 行出现错误:
ORA-00902: 无效数据类型

我的数据库是oracle 10g
请主委ggjj 帮忙看看
* 是在 nextval 下面

sequence.nextval不能作为数据类型使用, 只能在SQL语句或者PL/SQL存储过程中使用.

正确的方法是
create table testtable("id" int, "name" varchar2(10));

CREATE SEQUENCE seq_id
MINVALUE 1
START WITH 1
INCREMENT BY 1
CACHE 20;

insert into testtable values
(seq_id.nextval, ...);

请参考我以前回答的问题:http://zhidao.baidu.com/question/54159364.html