oracle中使用Cast函数时出错 [英] error while using Cast function in oracle
问题描述
HI,
我在Oracle中存储了存储过程,该存储过程由于以下错误而无法编译:
发生以下错误:
I have stored procedure in Oracle which is not getting compiled due to the following error:
The following error has occurred:
PROCEDURE STRL.SP_BEDOCC<br />
On line: 19<br />
PLS-00103: Encountered the symbol "(" when expecting one of the following:<br />
) varying large
以下是我程序的第19行
Below is the line no 19 of my procedure
v_yearmonth := CAST(v_fin_year AS CHAR(4)) || v_month ;
v_month和v_yearmonth是字符类型,而v_fin_year是数字类型.我需要4个字符的v_fin_year与2个字符的v_month合并,以便v_yearmonth是6个字符.
有人可以让我知道可能是什么问题吗?
任何帮助将不胜感激.
问候,
Gopal
v_month and v_yearmonth are of char type and v_fin_year is of number type. I need v_fin_year in 4 characters to concatnate it with v_month which is of 2 chars so that v_yearmonth is of 6 chars.
Can anybody let me know what could be the issue??
any help would be much appreciated.
Regards,
Gopal
推荐答案
尝试改用to_char
,例如:
Try usingto_char
instead, like:
to_char(v_fin_year, ''9999'')
祝你好运!
Good luck!
这篇关于oracle中使用Cast函数时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!