简体   繁体   English

Oracle SQL 中的 $$(双美元)是什么意思?

[英]What does $$ (double dollar) mean in Oracle SQL?

This Create package query executes in a SQLPlus util cli without error -此 Create package 查询在 SQLPlus util cli 中执行而没有错误 -

create or replace package PACKAGE2 as 
$if $$install_ad_zd_sys $then 
procedure LOG( X_MODULE varchar2, X_LEVEL varchar2, X_MESSAGE varchar2); 
function LITERAL(X_VALUE varchar2) return varchar2; 

else procedure LOG_VER; 

$end 
end;
/

Just want to know what does double dollar mean here?只是想知道这里的双美元是什么意思? Is it a sqlplus specific keyword?它是 sqlplus 特定的关键字吗?

I tried running this whole block as part of jdbc but it gives error 'Invalid column index'.我尝试将整个块作为 jdbc 的一部分运行,但它给出了错误“无效的列索引”。 So, I am suspecting the sign is specific to sqlplus, but not able to find the meaning of it.所以,我怀疑这个标志是 sqlplus 特有的,但无法找到它的含义。

This is how I am executing the above sql in java jdbc这就是我在 java jdbc 中执行上述 sql 的方式

 plSqlstatement = connection.prepareCall(sqlBuffer.toString()); //sqlBuffer contains the whole create package block //like sqlBuffer.append("CREATE OR REPLACE //PACKAGE....").append("/n").append(..next Line) and so on.

It's an inquiry directive :这是一个查询指令

An inquiry directive provides information about the compilation environment.查询指令提供有关编译环境的信息。

An inquiry directive typically appears in the boolean_static_expression of a selection directive, ...查询指令通常出现在选择指令的boolean_static_expression中,...

... which is how you are using it, as it's within the $if conditional compilation directive. ...这就是您使用它的方式,因为它在$if条件编译指令中。

You would need to assign a value , which you don't seem to be doing in either execution.您需要分配一个 value ,您似乎在任何一次执行中都没有这样做。 But it will compile anyway, through SQL*Plus or JDBC (as in this db<>fiddle ).但无论如何它都会通过 SQL*Plus 或 JDBC 编译(如在这个 db<>fiddle中)。

If you are getting an error from your JDBC call then you need to look at how you are running it - particularly if you are making get/set calls for arguments, as the error message suggests - since there are no arguments to set or retrieve.如果您从 JDBC 调用中收到错误,那么您需要查看您是如何运行它的 - 特别是如果您正在对 arguments 进行 get/set 调用,正如错误消息所暗示的那样 - 因为没有 ZDBC11CAA5BDA99F77E6FB4DAZBD82 设置为

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

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