---
title: "oracle 导入excel"
author: "dnanhui"
date: "2011-10-28T17:08:50Z"
tags: []
categories: ["编程语言"]
slug: "oracle-excel"
draft: false
lastmod: "2011-10-28T17:08:50Z"
id: 1221202
url: "https://dnanhui.iteye.com/blog/1221202"
---

先把excel改为csv文件，再编辑temp.ctl文件，如下：
load data
infile 'e:\city.csv'
replace into table sys_User_Role--表名
fields terminated by ',' optionally enclosed by '"'
trailing nullcols
(UserId,RoleId)--对应的列表

保存到E盘。


打开cmd:
sqlldr userid=root/root@elearning 按回键
control = e:\temp.ctl空格回车，就行了