简体   繁体   English

在PL / SQL匿名块中使用替换字符串

[英]Use substitution string in PL/SQL anonymous block

Is there any way to use a substitution string in PL/SQL anonymous block ? 有什么方法可以在PL / SQL匿名块中使用替换字符串? I tried to use my substitution string DATE_DIFF inside a PL/SQL anonymous block as &DATE_DIFF. 我试图在PL / SQL匿名块内将替换字符串DATE_DIFF用作&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. 在PL / SQL匿名块中使用替换字符串的示例代码。

DECLARE
 v_date_diff NUMBER;
BEGIN

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

END;

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. 在APEX中,当您想将某个项目的会话状态检索到选项卡,列表等中时,可以使用替换字符串语法( &DATE_DIFF. )。 In order to retrieve session state for an item in PL/SQL block, you either prefix item name with colon, or use V() function: 为了在PL / SQL块中检索项目的会话状态,可以在项目名称前加上冒号或使用V()函数:

  1. :DATE_DIFF
  2. v('DATE_DIF')

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

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