Update Oracle table with values from CSV file(使用 CSV 文件中的值更新 Oracle 表)
问题描述
我有一个包含 ID 和其他几个列的 CSV 文件.我在 oracle 中也有一个表,其中 ID 标识了一行.我怎样才能最好地用 CSV 文件中的值替换表中的值,同时保持其他列的原样?
I have a CSV file which contains an ID and several other columns. I also have a table in oracle where the ID identifies a row. How can I best replace the values that are in the table with the values in the CSV file while keeping the other columns the way they were before?
这必须使用 oracle 本身可用的工具(即 PL/SQL 或 SQL 脚本)来完成,我不能使用真正的"脚本语言(Python,...)或真正的"程序.
This has to be done with tools available in oracle itself (i.e. PL/SQL or SQL scripts), I can not use a "real" scripting language (Python, ...) or a "real" program.
谢谢,托马斯
推荐答案
查看 Oracle 文档中的 EXTERNAL TABLES.您可以将 csv 文件复制到 Oracle 服务器机器上,并让 Oracle 将其显示为普通"表,您可以在该表上运行查询.
Look at EXTERNAL TABLES in the Oracle doc. You can copy the csv file onto the Oracle server box and get Oracle to present it as a "normal" table on which you can run queries.
然后问题就变成了将数据从一张表复制到另一张表的问题.
Then the problem just becomes one of copying data from one table to another.
外部表对于处理这样的数据加载非常有用.
External tables are really very useful for handling data loads like this.
这篇关于使用 CSV 文件中的值更新 Oracle 表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 CSV 文件中的值更新 Oracle 表
基础教程推荐
- 是否可以执行按位分组功能? 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 无法解决整理冲突 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
