【发布时间】:2017-03-30 13:19:55
【问题描述】:
我有一个函数,我必须在其中添加 for update 子句。
FUNCTION FUNC_NAME(
strValues IN arrayofstrings)
RETURN arrayofnumbers IS
ids arrayofnumbers := arrayofnumbers();
BEGIN
SELECT myId BULK COLLECT INTO ids
FROM table_1
WHERE table_1.rownum1 IN (select column_value from table(strValues))
GROUP BY myId
HAVING count(*) = (select count(*) from table(strValues))
--for update of myId
;
RETURN ids;
END FUNC_NAME;
但如果删除评论,错误
Error(26,7): PL/SQL: ORA-01786: FOR UPDATE of this query expression is not allowed
如何重建我的查询?
【问题讨论】:
-
这是一个语法错误 - 它应该是
for update OF myId。 -
@TonyAndrews,是的,我在示例中错过了“OF”
-
@Nikolas。这里的问题是你为什么要那样做。你有什么要求。你不能用那种方式