【发布时间】:2013-10-24 04:19:08
【问题描述】:
有没有办法在 PL/SQL 匿名块中使用替换字符串?我尝试在 PL/SQL 匿名块中使用我的替换字符串 DATE_DIFF 作为 &DATE_DIFF. 但它给出了以下错误。
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
我该如何解决这个问题?
更新
在 PL/SQL 匿名块中使用替换字符串的示例代码。
DECLARE
v_date_diff NUMBER;
BEGIN
v_date_diff := &DATE_DIFF.; // this didn't work
END;
【问题讨论】:
-
替换变量是 SQLP*PLUS 相关的特性。其他一些工具可能支持也可能不支持。
-
@NicholasKrasnov Oracle APEX 支持替换字符串。
-
如果我在 PL/SQL 块中的 APEX 中没有记错的话,替换变量的语法应该是
:DATE_DIFF或使用V函数V('DATE_DIFF')。 -
@NicholasKrasnov 是的。
:DATE_DIFF完成了这项工作。谢谢 :)。将此作为答案发布,我会接受它作为正确答案。
标签: oracle plsql oracle11g oracle-apex substitution