我想创建一个为学生缺席的功能。如果他缺席3次,他将被淘汰。但是创建函数后,当我运行它时,它会告诉我找不到该函数。
CREATE OR REPLACE FUNCTION add_abbssence(
)
RETURNS TABLE( etudiant int , id_matiere int, abssance int)
LANGUAGE 'plpgsql'
COST 100
VOLATILE
ROWS 1000
AS $BODY$
begin
return query
select * from abssance order by id_abssance;
insert into id_abssance (id_etudiant,id_matiere,abssance)
values (etudiant,matiere ,abssance);
if abssane = 3 then
insert into abssance(eliminé)
values(1);
--if successful
--isnt there
end if ;
end
$BODY$;
当我运行它时,它告诉我
add_abbssence (integer, integer, integer) does not exist
LINE 1: select * from add_abbssence (66,1,1)
^
HINT: No function corresponds to the given name and to the types of arguments.
You need to add explicit type conversions.
声明的函数的参数为零,但在SELECT语句中,函数调用具有3个参数:这就是PostgreSQL不调用该函数的原因:函数调用的编号和参数类型必须与函数定义匹配。