oracle 可以通过序列来完成.  CREATE sequence seq_ID
     minvalue 1 
     start with 1 
     increment by 1 
     nocache;  通过seq_ID.nextval 取下一个值。
  或者写一个触发器:
 
CREATE or replace trigger insertID_for_news
before insert on news
for each row 
   
BEGIN 
    select seq_ID.nextval into :new.ID from dual;
END;
/

解决方案 »

  1.   

    body text NOT NULL  ,其中body是新闻管理系统中的新闻内容,内容要大于4000字,用什么类型啊
      

  2.   

    我可能偏离重点了,我是想大家帮我把这个表的sql语句翻译成oracle的,自增无所谓,数据库不支持,我就用程序实现,我要的是大家帮我把这段翻译成oracle的
      

  3.   

    CREATE TABLE news (
    id int(10) PRIMARY KEY,
    topic varchar(255) NOT NULL  , 
    body blog NOT NULL  , 
    hits number(10,0) NOT NULL  DEFAULT 0 , 
    adddate varchar(30) NOT NULL  DEFAULT '0000-00-00 00:00:00' , 
    adduser varchar(20) NOT NULL  , 
    rootid number(4,0) NOT NULL  DEFAULT 0 , 
    pic varchar(100)   ,
    ) ;
      

  4.   

    text 类型在oracle 中用clob实现.
    如果有image类型,可以用blob实现.
      

  5.   

    CREATE TABLE news (
    id int(10) PRIMARY KEY,
    topic varchar(255) NOT NULL  , 
    body blog NOT NULL  , 
    hits number(10,0) NOT NULL  DEFAULT 0 , 
    adddate varchar(30) NOT NULL  DEFAULT '0000-00-00 00:00:00' , 
    adduser varchar(20) NOT NULL  , 
    rootid number(4,0) NOT NULL  DEFAULT 0 , 
    pic varchar(100)   ,
    ) ;
    这个写的对吗?id int(10) PRIMARY KEY,对吗?
      

  6.   

    to 楼主:
     
      id int(10) PRIMARY KEY 
      ----------------------
      这句话不对,oracle没有int数据类型,用number类型代替.
      加primary key 可以通过添加约束的方式添加.
       在 "pic varchar(100),"这行后面添加:   constraint PK_ID primary key(ID)
       using index tablespace 索引所在的表空间
       storage(initial 40K next 40K pctincrease 1))
       tablespace 表所在的表空间名
       storage(initial 64k  next 64k  pctincrease 1);  如果是本地表空间管理模式,就不需要指定storage参数了.
      

  7.   

    body列建议使用clob,不用使用long.
      

  8.   


      id int(10) PRIMARY KEY, 
      ----------------------
       这行改成: id number(10),