简体   繁体   English

Oracle function 或 package 执行 Z9778840A0100CB30C9828 并返回记录 67A1

[英]Oracle function or package to execute SQL and return records

I need to call a package or function from Excel and cause the processing to be done on the server rather than on the local machine.我需要从 Excel 调用 package 或 function 并导致处理在服务器上而不是在本地计算机上完成。 To do this I need to pass a SELECT SQL statement to a package or function and it will return the record set.为此,我需要通过SELECT Z977840A0A0A0100CB30CB30C982876741B0B0B0B5A2Z将

The reason for this is that we have 100s of SQL statements that are currently processed in Excel but due to VPN slowness they are taking much longer.原因是我们有 100 条 SQL 语句当前在 Excel 中处理,但由于 VPN 速度慢,它们需要更长的时间。 I have tried a single package to run an SQL when called and it is significantly quicker.我试过一个 package 在调用时运行 SQL,它明显更快。 Any approach to pass only SELECT SQL statements to a function and just return the records will be a great help.任何仅将 SELECT SQL 语句传递给 function 并仅返回记录的方法都会有很大帮助。

Oracle version 11. Oracle 版本 11。

Have you access to Linux?您是否可以访问 Linux?

If you have created the statement and you only need the result of select in your output.如果您已经创建了语句并且您只需要 output 中的 select 的结果。 The most beautiful task is do:最美丽的任务是做:

SPOOL </my_folder/my_file.csv> SPOOL </my_folder/my_file.csv>

The below mentioned SELECT

SPOOL OFF;阀芯关闭;

If you create a SELECT statement like:如果您创建 SELECT 语句,例如:

SELECT col1 || ';' || col2 || ';' || ... || ';' || coln FROM MY_TABLE;

You will have CSV file, wherever you run your Oracle.无论您在何处运行 Oracle,您都将拥有 CSV 文件。

If you must create the SELECT STATEMENT with variables, You must work with REFCURSOR.如果必须使用变量创建 SELECT STATEMENT,则必须使用 REFCURSOR。

Regards.问候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM