-- 施工告知检验任务表
CREATE TABLE CY_SGGZJYRW (
    GZID VARCHAR2(40) NOT NULL,
    SLH VARCHAR2(50),
    BZLX VARCHAR2(10),
    JHKGSJ DATE,
    GZRQ DATE,
    GZRQA DATE,
    WJLY VARCHAR2(2),
    SYDWDM VARCHAR2(50),
    SYDWMC VARCHAR2(100),
    SYDWDZ VARCHAR2(100),
    YZBM VARCHAR2(10),
    SGDWDM VARCHAR2(50),
    SGDWMC VARCHAR2(100),
    JBR VARCHAR2(20),
    YZH VARCHAR2(50),
    YXQZ VARCHAR2(20),
    SYDWSQFPDM VARCHAR2(50),
    SYDWGSGLDM VARCHAR2(100),
    SYDWLXDH VARCHAR2(30),
    JHSJ DATE,
    IS_READED VARCHAR2(1) DEFAULT '0',
    BZ VARCHAR2(500),
    IS_DEL NUMBER(5) DEFAULT NULL,
    IS_VALID NUMBER(5) DEFAULT 1
);

-- 添加表注释
COMMENT ON TABLE CY_SGGZJYRW IS '施工告知检验任务表';

-- 添加字段注释
COMMENT ON COLUMN CY_SGGZJYRW.GZID IS '唯一ID';
COMMENT ON COLUMN CY_SGGZJYRW.SLH IS '告知号（与子表关联）';
COMMENT ON COLUMN CY_SGGZJYRW.BZLX IS '告知类型（1,安装,2,维修,3,改造,4,移装）';
COMMENT ON COLUMN CY_SGGZJYRW.JHKGSJ IS '计划开工日期';
COMMENT ON COLUMN CY_SGGZJYRW.GZRQ IS '告知日期';
COMMENT ON COLUMN CY_SGGZJYRW.GZRQA IS '告知盖章日期';
COMMENT ON COLUMN CY_SGGZJYRW.WJLY IS '文件来源';
COMMENT ON COLUMN CY_SGGZJYRW.SYDWDM IS '使用单位代码';
COMMENT ON COLUMN CY_SGGZJYRW.SYDWMC IS '使用单位名称';
COMMENT ON COLUMN CY_SGGZJYRW.SYDWDZ IS '使用单位地址';
COMMENT ON COLUMN CY_SGGZJYRW.YZBM IS '邮政编码';
COMMENT ON COLUMN CY_SGGZJYRW.SGDWDM IS '施工单位代码';
COMMENT ON COLUMN CY_SGGZJYRW.SGDWMC IS '施工单位名称';
COMMENT ON COLUMN CY_SGGZJYRW.JBR IS '市局登记人员编号';
COMMENT ON COLUMN CY_SGGZJYRW.YZH IS '验证号';
COMMENT ON COLUMN CY_SGGZJYRW.YXQZ IS '有效期限';
COMMENT ON COLUMN CY_SGGZJYRW.SYDWSQFPDM IS '使用单位街道';
COMMENT ON COLUMN CY_SGGZJYRW.SYDWGSGLDM IS '使用单位区域';
COMMENT ON COLUMN CY_SGGZJYRW.SYDWLXDH IS '使用单位联系电话';
COMMENT ON COLUMN CY_SGGZJYRW.JHSJ IS '交换时间';
COMMENT ON COLUMN CY_SGGZJYRW.IS_READED IS '0为未读，1为已读';
COMMENT ON COLUMN CY_SGGZJYRW.BZ IS '备注';
COMMENT ON COLUMN CY_SGGZJYRW.IS_DEL IS '删除标记(20120330) -1或NULL=不删除；1=删除';
COMMENT ON COLUMN CY_SGGZJYRW.IS_VALID IS '有效标记(20120330) 0=无效；1=有效';

-- 创建主键
ALTER TABLE CY_SGGZJYRW ADD CONSTRAINT PK_CY_SGGZJYRW PRIMARY KEY (GZID);

-- 创建索引
CREATE INDEX IDX_CY_SGGZJYRW_SLH ON CY_SGGZJYRW(SLH);
CREATE INDEX IDX_CY_SGGZJYRW_SYDWDM ON CY_SGGZJYRW(SYDWDM);
CREATE INDEX IDX_CY_SGGZJYRW_SGDWDM ON CY_SGGZJYRW(SGDWDM);
CREATE INDEX IDX_CY_SGGZJYRW_IS_READED ON CY_SGGZJYRW(IS_READED);
CREATE INDEX IDX_CY_SGGZJYRW_IS_DEL ON CY_SGGZJYRW(IS_DEL);
CREATE INDEX IDX_CY_SGGZJYRW_IS_VALID ON CY_SGGZJYRW(IS_VALID);