gpt4 book ai didi

Oracle:查询中的 DML 操作

转载 作者:行者123 更新时间:2023-12-04 02:50:28 27 4
gpt4 key购买 nike

<分区>

我收到这个错误:

cannot perform a DML operation inside a query

当我尝试执行查询时

select st_atten_up(1,7) from dual;

代码如下。

create or replace FUNCTION st_atten_up(stu_id IN student_info.id%type,app_mon IN student_attendence.month%type) 
RETURN NUMBER
IS
att1 NUMBER;
BEGIN SELECT ATTENDANCE into att1 FROM student_attendence
WHERE student_attendence.id = stu_id and student_attendence.month = app_mon;
att1 := att1 + 1;
UPDATE student_attendence SET ATTENDANCE = att1
where id = stu_id and month = app_mon;
return att1;
END;

提前致谢。

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com