zoukankan      html  css  js  c++  java
  • 将Excel导入Oracle中

    1.录入excel测试表格,test.xls。
    2.另存为.csv格式
    3.创建sql*loader控制文件test.ctl,内容如下:
    Load data
    Infile 'c:\test.csv'
    insert Into table test Fields terminated by ','(column1,column2,column3,column4,column5)    

    需要将数据文件拷贝到对应位置

    4.到数据库中建立对应的测试表test

    create table test (
    column1 Varchar2(10),
    column2 Varchar2(10),
    column3 Varchar2(10),
    column4 Varchar2(10),
    column5 Varchar2(10)
    )

    5.执行导入命令
    Sqlldr userid = system/manager control='C:\test.ctl'

    导入成功!

    附:
    Sqlldr的函数关键字说明:
    Userid   --oracle用户名 userid = username/password
    Control --控制文件名称 control = ‘e:\insert.ctl’
    Log     –-日志文件名称 log = ‘e:\insert.log’
    Bad     --损坏文件名称
    Data     --data file name
    Discard    --discard file name
    Discardmax --number of discards to allow(默认全部)
    Skip       --导入时跳过的记录行数(默认0)
    Load       --导入时导入的记录行数(默认全部)
    Errors    --允许错误的记录行数(默认50)

    ctl文件内容说明:
    Load data
    Infile ‘e:\test.csv’          --数据源文件名称
    Append|insert|replace       --append在表后追加,insert插入空表,replace替代原有内容
    Into table test            --要导入的数据库表名称
    [when id = id_memo]     --过滤条件
    Fields terminated by X’09’ --字段分隔符
    (id,name,telphone)        --字段名称列表
  • 相关阅读:
    numpy数组中round, around, rint, ceil, floor, modf, trunc, fix
    基于KNN算法实现手写数字识别
    PM2.5预测(李宏毅机器学习hw_1)
    numpy的array和asarray
    iOS socket
    UIScrollView
    ios读取文件
    CGContext绘图
    UINavigationController和UITabBarController合用
    window下svn开机自动启动
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/2213678.html
Copyright © 2011-2022 走看看