CREATE TABLE `tb_key_sequence` ( `seq_name` varchar(3) NOT NULL COMMENT '시퀀스 prefix', `seq_no` int NOT NULL COMMENT '시퀀스 no', PRIMARY KEY (`seq_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='tb_key_sequence'; CREATE FUNCTION `fn_get_key_seq`(`p_seq_name` VARCHAR(3), `p_key_length` int) RETURNS varchar(20) CHARSET utf8 BEGIN DECLARE RTN_VAL VARCHAR(20); INSERT INTO tb_key_sequence (seq_name, seq_no) values (p_seq_name, LAST_INSERT_ID(1)) ON DUPLICATE KEY UPDATE seq_no=LAST_INSERT_ID(seq_no+1); set @ret = row_count(); if @ret = 0 then set RTN_VAL = '0'; else SET RTN_VAL = (SELECT TRIM(CONCAT(p_seq_name, LPAD(LAST_INSERT_ID(),p_key_length,'0')))); end if; RETURN RTN_VAL; END ; CREATE DEFINER = root@`%` VIEW xit_vw_user_mastr AS SELECT `xplatform`.`xit_gnrl_mber`.`ESNTL_ID` AS `ESNTL_ID`, `xplatform`.`xit_gnrl_mber`.`MBER_ID` AS `USER_ID`, `xplatform`.`xit_gnrl_mber`.`PASSWORD` AS `PASSWORD`, `xplatform`.`xit_gnrl_mber`.`MBER_NM` AS `USER_NM`, `xplatform`.`xit_gnrl_mber`.`ZIP` AS `USER_ZIP`, `xplatform`.`xit_gnrl_mber`.`ADRES` AS `USER_ADRES`, `xplatform`.`xit_gnrl_mber`.`MBER_EMAIL_ADRES` AS `USER_EMAIL`, ' ' AS `GROUP_ID`, 'GNR' AS `USER_SE`, ' ' AS `ORGNZT_ID`, ' ' AS `PSTINST_CODE`, ' ' AS `ORGNZT_NM`, ' ' AS `JOB_DATA_AUTHOR`, ' ' AS `USER_MANAGE_AUTHOR`, ' ' AS `ELCTRNSANCTN_USE_YN`, ' ' AS `JOB_CONFM_AUTHOR_YN` FROM `xplatform`.`xit_gnrl_mber` UNION ALL SELECT `a`.`ESNTL_ID` AS `ESNTL_ID`, `a`.`USER_ID` AS `USER_ID`, `a`.`PASSWORD` AS `PASSWORD`, `a`.`USER_NM` AS `USER_NM`, `a`.`ZIP` AS `ZIP`, `a`.`HOUSE_ADRES` AS `HOUSE_ADRES`, `a`.`EMAIL_ADRES` AS `EMAIL_ADRES`, `a`.`GROUP_ID` AS `GROUP_ID`, 'USR' AS `USER_SE`, `a`.`orgnzt_id` AS `ORGNZT_ID`, `a`.`pstinst_code` AS `PSTINST_CODE`, (SELECT `sa`.`ORGNZT_NM` FROM `xplatform`.`xit_orgnzt_info` `sa` WHERE `sa`.`ORGNZT_ID` = `a`.`orgnzt_id`) AS `ORGNZT_NM`, `b`.`JOB_DATA_AUTHOR` AS `JOB_DATA_AUTHOR`, `b`.`USER_MANAGE_AUTHOR` AS `USER_MANAGE_AUTHOR`, `b`.`ELCTRNSANCTN_USE_YN` AS `ELCTRNSANCTN_USE_YN`, `b`.`JOB_CONFM_AUTHOR_YN` AS `JOB_CONFM_AUTHOR_YN` FROM (`xplatform`.`xit_user_info` `a` LEFT JOIN `xplatform`.`xit_user_etc_option` `b` ON (`a`.`USER_ID` = `b`.`USER_ID`)) UNION ALL SELECT `xplatform`.`xit_entrprs_mber`.`ESNTL_ID` AS `ESNTL_ID`, `xplatform`.`xit_entrprs_mber`.`ENTRPRS_MBER_ID` AS `USER_ID`, `xplatform`.`xit_entrprs_mber`.`ENTRPRS_MBER_PASSWORD` AS `ENTRPRS_MBER_PASSWORD`, `xplatform`.`xit_entrprs_mber`.`CMPNY_NM` AS `CMPNY_NM`, `xplatform`.`xit_entrprs_mber`.`ZIP` AS `ZIP`, `xplatform`.`xit_entrprs_mber`.`ADRES` AS `ADRES`, `xplatform`.`xit_entrprs_mber`.`APPLCNT_EMAIL_ADRES` AS `APPLCNT_EMAIL_ADRES`, ' ' AS `GROUP_ID`, 'ENT' AS `USER_SE`, ' ' AS `ORGNZT_ID`, ' ' AS `PSTINST_CODE`, ' ' AS `ORGNZT_NM`, ' ' AS `JOB_DATA_AUTHOR`, ' ' AS `USER_MANAGE_AUTHOR`, ' ' AS `ELCTRNSANCTN_USE_YN`, ' ' AS `JOB_CONFM_AUTHOR_YN` FROM `xplatform`.`xit_entrprs_mber`;