请教各位:存储过程如下:
create or replace procedure pro3(
countt out number,
)
as
s_sql varchar2(500);
begin s_sql:='select count(*) from shiyourenkou where months_between(trunc(sysdate,'mm'),trunc(birth,'mm'))>=192 '; //就这句报错,这句是计算年龄大于16岁的人数,在sql命令中是通过的,在存储过程中出错
execute immediate s_sql into countt;end pro3;
错误如下:
Compilation errors for PROCEDURE SYSTEM.PRO3Error: PLS-00103: 出现符号 "MM"在需要下列之一时:
* & = - + ; < / > at in is
mod remainder not rem <an exponent (**)> <> or != or ~= >= <=
<> and or like LIKE2_ LIKE4_ LIKEC_ between || multiset
member SUBMULTISET_
Line: 10
Text: s_sql:='select count(*) from shiyourenkou where months_between(trunc(sysdate,'mm'),trunc(birth,'mm'))>=192 ';
create or replace procedure pro3(
countt out number,
)
as
s_sql varchar2(500);
begin s_sql:='select count(*) from shiyourenkou where months_between(trunc(sysdate,'mm'),trunc(birth,'mm'))>=192 '; //就这句报错,这句是计算年龄大于16岁的人数,在sql命令中是通过的,在存储过程中出错
execute immediate s_sql into countt;end pro3;
错误如下:
Compilation errors for PROCEDURE SYSTEM.PRO3Error: PLS-00103: 出现符号 "MM"在需要下列之一时:
* & = - + ; < / > at in is
mod remainder not rem <an exponent (**)> <> or != or ~= >= <=
<> and or like LIKE2_ LIKE4_ LIKEC_ between || multiset
member SUBMULTISET_
Line: 10
Text: s_sql:='select count(*) from shiyourenkou where months_between(trunc(sysdate,'mm'),trunc(birth,'mm'))>=192 ';
修改成如下:
s_sql:='select count(*) from shiyourenkou where months_between(trunc(sysdate,''mm''),trunc(birth,''mm''))>=192 '表示单引号 ' 需要 ''