oracle 将查询结果导出到一组 INSERT 语句?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10832631/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:13:00  来源:igfitidea点击:

Export results of a query to a set of INSERT statements?

oracleexport

提问by CSharpened

In Oracle I have the requirement to produce a set of INSERT statements using the results of a SELECT statement. Basically the same way that Toad for Oracle will export the contents of a table to a set of Insert Statements either in a file or on the clip board. Is this possible?

在 Oracle 中,我需要使用 SELECT 语句的结果生成一组 INSERT 语句。基本上与 Toad for Oracle 将表的内容导出到文件或剪贴板上的一组插入语句的方式相同。这可能吗?

The reason for this is that some of my geometric data is in WGS84 format and when I access it it needs to be British National Grid. This is not a problem in Oracle as I can simply use SDO_CS.Transform(date, srid) however in SQL Server this is not possible. My intention is to produce the INSERTS in Toad and them run them on SQL Server in order to populate the geometry column with the pre-transformed data. This means applying the transform in Oracle during the SELECT.

这样做的原因是我的一些几何数据是 WGS84 格式的,当我访问它时,它需要是英国国家网格。这在 Oracle 中不是问题,因为我可以简单地使用 SDO_CS.Transform(date, srid) 但是在 SQL Server 中这是不可能的。我的目的是在 Toad 中生成 INSERTS 并在 SQL Server 上运行它们,以便用预转换的数据填充几何列。这意味着在 SELECT 期间在 Oracle 中应用转换。

回答by Codo

I don't quite understand how you're trying to export the data from TOAD. But it should work as follows:

我不太明白您是如何尝试从 TOAD 导出数据的。但它应该如下工作:

  1. Run your SELECT statement in a TOAD editor window.
  2. Press the right mouse button in the data grid with the result and select "Export dataset...".
  3. Choose "Insert Statements" from the first drop down.
  4. Click OK.
  1. 在 TOAD 编辑器窗口中运行 SELECT 语句。
  2. 在带有结果的数据网格中按鼠标右键并选择“导出数据集...”。
  3. 从第一个下拉菜单中选择“插入语句”。
  4. 单击确定。