我想写个自己的函数返回符合条件的记录总数,脚本如下:create or replace function GET_NOT_DEL_MSG_NUM(NEW_MSG_ID IN NUMBER)
return NUMBER is N_NOT_DEL_NUM long;
begin
N_NOT_DEL_NUM:=(SELECT COUNT(*) FROM T_MSG_CLIENT_MSG WHERE N_MSG_ID=NEW_MSG_ID AND N_IS_DELETE=1);
return N_NOT_DEL_NUM;
end GET_NOT_DEL_MSG_NUM;
/
在执行的时候出现以下错误:
-------- ----------------------------------------------------------------
4/14 PLS-00103: 出现符号 "SELECT"在需要下列之一时:
( - + case mod new not
null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior 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
<一个带有字符集说明的可带引号的字符串文字>
<一个可带引号的 SQL 字符串>
LINE/COL ERROR
-------- ----------------------------------------------------------------
4/96 PLS-00103: 出现符号 ")"在需要下列之一时:
* & - + ; / at for mod
remainder rem <an exponent (**)> and or group having
intersect minus order start union where connect || multiset7/0 PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
end not pragma
final instantiable order overriding static member constructor
map请高手指教!谢谢
return NUMBER is N_NOT_DEL_NUM long;
begin
N_NOT_DEL_NUM:=(SELECT COUNT(*) FROM T_MSG_CLIENT_MSG WHERE N_MSG_ID=NEW_MSG_ID AND N_IS_DELETE=1);
return N_NOT_DEL_NUM;
end GET_NOT_DEL_MSG_NUM;
/
在执行的时候出现以下错误:
-------- ----------------------------------------------------------------
4/14 PLS-00103: 出现符号 "SELECT"在需要下列之一时:
( - + case mod new not
null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior 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
<一个带有字符集说明的可带引号的字符串文字>
<一个可带引号的 SQL 字符串>
LINE/COL ERROR
-------- ----------------------------------------------------------------
4/96 PLS-00103: 出现符号 ")"在需要下列之一时:
* & - + ; / at for mod
remainder rem <an exponent (**)> and or group having
intersect minus order start union where connect || multiset7/0 PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
end not pragma
final instantiable order overriding static member constructor
map请高手指教!谢谢
into N_NOT_DEL_NUM
FROM T_MSG_CLIENT_MSG WHERE N_MSG_ID=NEW_MSG_ID AND N_IS_DELETE=1;
改成
SELECT COUNT(*) INTO N_NOT_DEL_NUM FROM T_MSG_CLIENT_MSG WHERE N_MSG_ID=NEW_MSG_ID AND N_IS_DELETE=1;
create or replace function GET_NOT_DEL_MSG_NUM(NEW_MSG_ID IN NUMBER)
return NUMBER is N_NOT_DEL_NUM long;
begin
SELECT COUNT(*) INTO N_NOT_DEL_NUM FROM T_MSG_CLIENT_MSG WHERE N_MSG_ID=NEW_MSG_ID AND N_IS_DELETE=1;
return N_NOT_DEL_NUM;
end GET_NOT_DEL_MSG_NUM;