-- 合同方子表补充主体编码字段
DECLARE
    v_count NUMBER := 0;
BEGIN
    SELECT COUNT(1)
      INTO v_count
      FROM USER_TAB_COLUMNS
     WHERE TABLE_NAME = 'SEAL_CONTRACT_LAUNCH_PARTY'
       AND COLUMN_NAME = 'SUBJECT_CODE';

    IF v_count = 0 THEN
        EXECUTE IMMEDIATE 'ALTER TABLE SEAL_CONTRACT_LAUNCH_PARTY ADD SUBJECT_CODE VARCHAR2(100 CHAR)';
        EXECUTE IMMEDIATE 'COMMENT ON COLUMN SEAL_CONTRACT_LAUNCH_PARTY.SUBJECT_CODE IS ''主体编码（我方主体组织ID，相对方通常为空）''';
    END IF;
END;
/
