简体   繁体   中英

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

This Create package query executes in a SQLPlus util cli without error -

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?

I tried running this whole block as part of jdbc but it gives error 'Invalid column index'. So, I am suspecting the sign is specific to sqlplus, but not able to find the meaning of it.

This is how I am executing the above sql in java jdbc

 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, ...

... which is how you are using it, as it's within the $if conditional compilation directive.

You would need to assign a value , which you don't seem to be doing in either execution. But it will compile anyway, through SQL*Plus or JDBC (as in this 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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