在powerdesign里面设计好了数据库,问下,如何自动生成oracle的建表语句啊?我邮件 -->sql previews出来的在plsql的sql窗口一运行,老是报错?ORA-00900: not invalid identifer

解决方案 »

  1.   

    /*==============================================================*/
    /* DBMS name:      Sybase AS Anywhere 9                         */
    /* Created on:     2009-04-13 10:30:59                          */
    /*==============================================================*/
    if exists(
       select 1 from sys.systable 
       where table_name='T_ACCESS_COUNT'
         and table_type in ('BASE', 'GBL TEMP')
    ) then
        drop table T_ACCESS_COUNT
    end if;if exists(
       select 1 from sys.systable 
       where table_name='T_DEPARTMENT_TYPE'
         and table_type in ('BASE', 'GBL TEMP')
    ) then
        drop table T_DEPARTMENT_TYPE
    end if;if exists(
       select 1 from sys.systable 
       where table_name='T_MESSAGE'
         and table_type in ('BASE', 'GBL TEMP')
    ) then
        drop table T_MESSAGE
    end if;if exists(
       select 1 from sys.systable 
       where table_name='T_REPOSITY_INDEX'
         and table_type in ('BASE', 'GBL TEMP')
    ) then
        drop table T_REPOSITY_INDEX
    end if;if exists(
       select 1 from sys.systable 
       where table_name='T_SEARCH_KEY'
         and table_type in ('BASE', 'GBL TEMP')
    ) then
        drop table T_SEARCH_KEY
    end if;if exists(
       select 1 from sys.systable 
       where table_name='T_SORT'
         and table_type in ('BASE', 'GBL TEMP')
    ) then
        drop table T_SORT
    end if;if exists(
       select 1 from sys.systable 
       where table_name='T_TOOLS'
         and table_type in ('BASE', 'GBL TEMP')
    ) then
        drop table T_TOOLS
    end if;
    if exists(
       select 1 from sys.systable 
       where table_name='T_WORKPAPER'
         and table_type in ('BASE', 'GBL TEMP')
    ) then
        drop table T_WORKPAPER
    end if;
    /*==============================================================*/
    /* Table: T_MESSAGE                                             */
    /*==============================================================*/
    create table T_MESSAGE 
    (
        ID                   numeric                        not null,
        CONTENT              varchar(2000),
        RECEIVED_ID          numeric,
        WORK_ID              numeric,
        DEAL_USER_ID         numeric,
        ISREAD               numeric,
        constraint PK_T_MESSAGE primary key (ID)
    );comment on table T_MESSAGE is 
    '工单处理信息表:工单处理完毕后,系统给发起工单的用户留言‘处理完毕’';comment on column T_MESSAGE.ID is 
    '消息标识ID';comment on column T_MESSAGE.CONTENT is 
    '消息内容';comment on column T_MESSAGE.RECEIVED_ID is 
    '消息录入用户ID';comment on column T_MESSAGE.WORK_ID is 
    '消息录入时间';/*==============================================================*/
    /* Table: T_REPOSITORY_RELATION                                 */
    /*==============================================================*/
    create table T_REPOSITORY_RELATION 
    (
        ID                   numeric,
        RELATION_IDS         varchar(4000),
        POST_USER_ID         numeric,
        POST_TIME            date,
        STATUS               numeric
    );comment on table T_REPOSITORY_RELATION is 
    '知识库信息关联表';/*==============================================================*/
    /* Table: T_REPOSITORY_SYS_LOG                                  */
    /*==============================================================*/
    create table T_REPOSITORY_SYS_LOG 
    (
        ID                   numeric                        not null,
        OPER_USER_ID         numeric,
        OPER_TABLE           varchar(50),
        OPER_TABLE_ID        numeric,
        OPER_ACTION          varchar(20),
        OPER_RESULT          varchar(500),
        OPER_ERROR           varchar(500),
        OPER_TIME            date,
        constraint PK_T_REPOSITORY_SYS_LOG primary key (ID)
    );comment on table T_REPOSITORY_SYS_LOG is 
    '知识库操作日志表';comment on column T_REPOSITORY_SYS_LOG.ID is 
    '日志标识ID';comment on column T_REPOSITORY_SYS_LOG.OPER_USER_ID is 
    '操作员人员ID';comment on column T_REPOSITORY_SYS_LOG.OPER_TABLE is 
    '操作表名字
    ';comment on column T_REPOSITORY_SYS_LOG.OPER_TABLE_ID is 
    '操作表的数据标识ID';comment on column T_REPOSITORY_SYS_LOG.OPER_ACTION is 
    '操作动作(insert、update、delete、search)';comment on column T_REPOSITORY_SYS_LOG.OPER_RESULT is 
    '操作结果';comment on column T_REPOSITORY_SYS_LOG.OPER_ERROR is 
    '操作失败信息';comment on column T_REPOSITORY_SYS_LOG.OPER_TIME is 
    '操作时间';/*==============================================================*/
    /* Table: T_REPOSITY                                            */
    /*==============================================================*/
    create table T_REPOSITY 
    (
        ID                   numeric                        not null,
        FILE_ID              varchar(20),
        TITLE                varchar(100),
        CONTENT              clob,
        TYPE                 numeric,
        DISABLEED            date,
        VALID_TIME           date,
        LEVEL_ID             numeric,
        STATUS               numeric,
        POST_USER_ID         numeric,
        POST_TIME            datetime,
        UPDATE_USER_ID       numeric,
        UPDATE_TIME          date,
        CHECK_USER_ID        numeric,
        CHECK_TIME           date,
        constraint PK_T_REPOSITY primary key (ID)
    );comment on table T_REPOSITY is 
    '知识库信息表';comment on column T_REPOSITY.ID is 
    '标识ID';comment on column T_REPOSITY.FILE_ID is 
    '文件编号,唯一值';comment on column T_REPOSITY.TITLE is 
    '知识库标题';comment on column T_REPOSITY.CONTENT is 
    '知识库内容';comment on column T_REPOSITY.TYPE is 
    '知识库分类';comment on column T_REPOSITY.DISABLEED is 
    '失效时间';comment on column T_REPOSITY.LEVEL_ID is 
    '重要 置1 一般置-1';comment on column T_REPOSITY.STATUS is 
    '状态 -2未审核 -1审核未通过 1 审核通过 2失效 3 删除';/*==============================================================*/
    /* Table: T_REPOSITY_ANNEX                                      */
    /*==============================================================*/
    create table T_REPOSITY_ANNEX 
    (
        PK_AUTO_ID           NUMBER,
        FK__REPOSITORY_ID    VARCHAR,
        ANNEX_PATH           VARCHAR,
        FK_POST_USER_ID      NUMBER,
        POST_TIME            DATE,
        NUMBER               NUMBER,
        UPDATE_TIME          DATE
    );comment on table T_REPOSITY_ANNEX is 
    '知识库信息对应附件表';/*==============================================================*/
    /* Table: T_REPOSITY_INDEX                                      */
    /*==============================================================*/
    create table T_REPOSITY_INDEX 
    (
        ID                   numeric                        not null,
        FILE_ID              varchar(20),
        TITLE                varchar(100),
        CONTENT              clob,
        TYPE                 numeric,
        DISABLEED            date,
        VALID_TIME           date,
        LEVEL_ID             numeric,
        STATUS               numeric,
        POST_USER_ID         numeric,
        POST_TIME            date,
        UPDATE_USER_ID       numeric,
        UPDATE_TIME          date,
        CHECK_USER_ID        numeric,
        CHECK_TIME           date,
        constraint PK_T_REPOSITY_INDEX primary key (ID)
    );
    /*==============================================================*/
    /* Table: T_SORT                                                */
    /*==============================================================*/
    create table T_SORT 
    (
        ID                   numeric,
        PID                  numeric,
        NAME                 varchar(20),
        SORT                 numeric,
        CHECK_FLAG           numeric,
        PUBLIC_TAG           numeric,
        TEMPLATE_ID          numeric,
        POST_USER_ID         numeric,
        POST_TIME            datet,
        UPDATE_USER_ID       numeric,
        UPDATE_TIME          date,
        IS_FINAL             numeric,
        INDEX_NUM            numeric
    );
    .......comment on column T_WORKPAPER.DEAL_USER_ID is 
    '当用户进行审核的时候,在处理完毕之前,绑定这个工单,别的用户不能操作这个工单。';这是我根据powerdesigner生成的sql脚本,在plsql里面执行不通过,报错如下:ORA-00900: invalid SQL statement
      

  2.   

    一眼看去,你生成的语句明显是SQL SERVER的.需要修改你的DBMS类型.
    Database -->Change Current DBMS ...-->选择你要的oracle版本.
      

  3.   

    楼主也用Sybase数据库,呵呵.
      

  4.   

    必须是PDM才能对应数据库,CDM需要先进化成PDMPDM选择generate database即可生成脚本
    如果中途出错,作对应修改即可
      

  5.   

    用概念模型(CDM)生成物理模型(PDM),注意选择DBMS的数据库要选成ORACLE
      

  6.   

    /*==============================================================*/
    /* DBMS name:      Sybase AS Anywhere 9                         */
    /* Created on:     2009-04-13 10:30:59                          */
    /*==============================================================*/
    从这里可以看出,楼主用的是默认的Sybase数据库,所以生成的脚本是Sybase数据库规范的。你需要进去 Database-->Change the Target DBMS-->General-->DBMS选项里面选择你的oracle版本即可,点击确定按钮。
    然后Database-->Database General生成脚本!
      

  7.   

    csdn无法上次本地图片啊,我的错误图片发不出来,郁闷!
      

  8.   

    你这sql语句是怎么生成的?给你个根据PD模型生成SQL语句的软件要不要?