最近工作中碰到excel文件数据导入oracle数据库表中的技术问题。以前未处理过,决定利用这次机会,好好研究研究。
可先建一临时表,字段和要导入的Excel表的列一致
运行以下SQL语句,使临时表可写
select client_code, sub_date, back_date, cons_comp_name, credit_rate, rating_prospect, credit_space, risk_limit, govern_amt, facility_amt, transfer_amt, comp_amt, guarantee_amt, increase_amt, max_assure_amt, guarantee_limit, credit_loan_amt, credit_cons_grade, rating_grade from t_out_cons_imp for update
字段的先后顺序与Excel中的列位置保持一致
复制数据到数据区,提交事务并按提示保存数据到数据库
缺点是只能适应小批量数据且单表导入
[@more@]
可先建一临时表,字段和要导入的Excel表的列一致
运行以下SQL语句,使临时表可写
select client_code, sub_date, back_date, cons_comp_name, credit_rate, rating_prospect, credit_space, risk_limit, govern_amt, facility_amt, transfer_amt, comp_amt, guarantee_amt, increase_amt, max_assure_amt, guarantee_limit, credit_loan_amt, credit_cons_grade, rating_grade from t_out_cons_imp for update
字段的先后顺序与Excel中的列位置保持一致
复制数据到数据区,提交事务并按提示保存数据到数据库
缺点是只能适应小批量数据且单表导入
[@more@]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/777981/viewspace-918927/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/777981/viewspace-918927/