Question

Is there any way to use a substitution string in PL/SQL anonymous block ? I tried to use my substitution string DATE_DIFF inside a PL/SQL anonymous block as &DATE_DIFF. But it gives below error.

ORA-06550: line 13, column 18: PLS-00103: Encountered the symbol "&" when expecting one of the following: ( - + all case mod new null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue any avg count current max min prior some sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set s

How can i solve this ?

UPDATED

sample code of using substitution string in PL/SQL anonymous block.

DECLARE
 v_date_diff NUMBER;
BEGIN

 v_date_diff := &DATE_DIFF.; // this didn't work

END;
Was it helpful?

Solution

In APEX, you use substitution string syntax (&DATE_DIFF.) when you want to retrieve session state for an item into tabs, lists, and so forth. In order to retrieve session state for an item in PL/SQL block, you either prefix item name with colon, or use V() function:

  1. :DATE_DIFF
  2. v('DATE_DIF')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top