更新数据库脚本的格式

如何更新数据库的脚本格式

  • 物理表新增字段:


ALTER TABLE XMFK_PROJECT_APPLY ADD (RMB_APP_MONEY  NUMBER(18,6));
ALTER TABLE XMFK_PROJECT_APPLY ADD (VERIFICATION  NUMBER(19,6));
ALTER TABLE XMFK_PROJECT_APPLY ADD (IS_FREE_TRANSFERS  VARCHAR2(50));

COMMENT ON COLUMN XMFK_PROJECT_APPLY.RMB_APP_MONEY IS '批复金额';
COMMENT ON COLUMN XMFK_PROJECT_APPLY.VERIFICATION IS '已付金额';
COMMENT ON COLUMN XMFK_PROJECT_APPLY.IS_FREE_TRANSFERS IS '是否无偿调拨净资产';
  • 新建表(先删后增)

-- 先删后增
DROP TABLE XMFK_ELEMENT cascade constraints;

-- 要素表
CREATE TABLE XMFK_ELEMENT
(
CHR_ID VARCHAR2(50) NOT NULL,
CHR_CODE VARCHAR2(96),
CHR_NAME VARCHAR2(96),
PARENT_CODE VARCHAR2(96),
CLUSTER PRIMARY KEY(CHR_ID)) STORAGE(ON "MAIN", CLUSTERBTR) ;
COMMENT ON TABLE XMFK_ELEMENT IS '项目付款申请书要素表';
COMMENT ON COLUMN XMFK_ELEMENT.CHR_CODE IS '编码';
COMMENT ON COLUMN XMFK_ELEMENT.CHR_ID IS '主键';
COMMENT ON COLUMN XMFK_ELEMENT.CHR_NAME IS '名称';
COMMENT ON COLUMN XMFK_ELEMENT.PARENT_CODE IS '父编码';

你可能感兴趣的:(sql)