因为业务的需要,现在需要查询1个表里的数据并插入到另一个表内且对应自己想要对应的列。
且表的id应该是根据序列自动生成。
生成序列:
create sequence history_seq start with 1 increment by 1 nomaxvalue nocycle;
插入的sql:
INSERT INTO A
(ID,REQ_ID,UPLOAD_TS,NAME,P_ID,MOBILE,QUERY_REASON,GUARANTEE_TYPE,
LOAN_PURPOSE,CUSTOM_TYPE,APPLY_AMOUNT,LOAN_ID,HOME_ADDRESS,
HOME_PHONE,WORK_NAME,WORK_ADDRESS,WORK_PHONE,DEVICE_TYPE,IMEI,MAC,
IP_ADDRESS,OS_NAME,DEPT_CODE,ORG_ENTITY,DATA_STAT,RPT_STAT,BH_EXIST,
BATCH_NUM,MSG_NUM,USER_ID,CREATE_TIME,UPDATE_TIME,RPT_TYPE,
RPT_USETIME,ERR_DESC,RPT_TIME)
(SELECT HISTORY_SEQ.NEXTVAL,b.REQ_ID,b.UPLOAD_TS,b.NAME,b.P_ID,b.MOBILE,
b.QUERY_REASON,b.GUARANTEE_TYPE,b.LOAN_PURPOSE,b.CUSTOM_TYPE,
b.APPLY_AMOUNT,b.LOAN_ID,b.HOME_ADDRESS,b.HOME_PHONE,b.WORK_NAME,
b.WORK_ADDRESS,b.WORK_PHONE,b.DEVICE_TYPE,b.IMEI,b.MAC,b.IP_ADDRESS,
b.OS_NAME,b.DEPT_CODE,b.ORG_ENTITY,b.DATA_STAT,b.RPT_STAT,b.BH_EXIST,
b.BATCH_NUM,b.MSG_NUM,b.USER_ID,b.CREATE_TIME,b.UPDATE_TIME,&