【发布时间】:2014-10-23 00:35:59
【问题描述】:
我有以下代码:
IF nvl(p_value, 0) >= 0 THEN
l_currency_prefix := 'scc.currency_prefix_pos';
l_currency_suffix := 'scc.currency_suffix_pos';
ELSE
l_currency_prefix := 'scc.currency_prefix_neg';
l_currency_suffix := 'scc.currency_suffix_neg';
END IF;
l_query := 'SELECT nvl('||l_currency_prefix||', '')'
||'trim(to_char('||p_value||
',scc.currency_format
,'||'NLS_NUMERIC_CHARACTERS=' || 'scc.decimal_group_separator'||'))'
||'nvl('||l_currency_suffix||', '')
FROM gss.gss_currency_locale scc
WHERE scc.country_code =' ||p_country_code||
'AND scc.currency_code ='|| p_currency_code||
'AND rownum=1';
这是 l_query 的 dbms 输出:
SELECT nvl(scc.currency_prefix_pos, ')trim(to_char(10000,scc.currency_format
,NLS_NUMERIC_CHARACTERS=scc.decimal_group_separator))nvl(scc.currency_suffix_pos, ')
FROM gss.gss_currency_locale scc
WHERE scc.country_code =USAND scc.currency_code =USDAND rownum=1
但是,它一直显示 ORA-00933 错误。 我调试这些代码几个小时,找不到错误在哪里。 有人可以就此提供一些建议吗?
提前致谢!
【问题讨论】:
-
这个错误是在设置字符串的代码中发生的,还是在您尝试执行它时发生的?
-
@GordonLinoff 嗨,戈登,我可以成功编译这个函数块,但是当我用这些输入参数调用/执行它时,它显示错误。谢谢!
-
。 .替换后用
l_query的值更新问题。 -
@GordonLinoff 添加了一小段代码。谢谢!
-
。 .不。打印出
l_query的值并显示出来。 (提示:dbms_output.put_line()。)
标签: sql plsql formatting ora-00933 to-char