Reputation: 101
What means sign $ before values in pl/sql?
Upvotes: 0
Views: 178
Reputation: 36832
$
in PL/SQL likely either means an Inquiry Directive or a Preprocessor Control Token. Those are tools for conditional compilation.
Some other uses of $
are for naming schema objects (but not for the first character), and for a regular expression anchor in a row pattern match element. The new 12c row pattern matching features adds some annoying ambiguity into even a simple lexical analysis of PL/SQL.
Here's an example with all 4 uses put together. This is valid code in 12c, although it doesn't do anything useful.
alter session set plsql_ccflags = 'inq_dir_test:1';
declare
v_test number;
begin
select $$inq_dir_test inq_dir_test$$
into v_test
from dual
match_recognize(
measures x.dummy dummy
pattern(
^$|
x{$$inq_dir_test}|
x{$IF 1=1 $THEN 1 $END}
)
define x as (1=1)
);
end;
/
Upvotes: 1