在我这里(oracle8.1.5)没问题啊,
SQL> declare
2 test int;
3 teststr varchar2(10);
4 testint int;
5 begin
6 test :=1;
7 teststr :=to_char(test);
8 DBMS_OUTPUT.PUT_LINE(TO_CHAR(test));
9 end;
10 /
1PL/SQL 过程已成功完成。
SQL> declare
2 test int;
3 teststr varchar2(10);
4 testint int;
5 begin
6 test :=1;
7 teststr :=to_char(test);
8 DBMS_OUTPUT.PUT_LINE(TO_CHAR(test));
9 end;
10 /
1PL/SQL 过程已成功完成。
month int;
monthstr varchar2(10);
begin
month :=2;
monthstr :=to_char(2); ---正常
monthstr :=to_char(month); --错误
DBMS_OUTPUT.PUT_LINE(monthstr);
end;
/
出现符号“)”在需要下列之一时 from
不用month直接用2 就可以,为什么啊, ?
这时定义的 month 数据库系统认为是格式符。
你重定义变量名为 month1 就没有这个问题了。
你改个名试试。