我需要检查一个音符是不是低于 95 并具有功能

Posted

技术标签:

【中文标题】我需要检查一个音符是不是低于 95 并具有功能【英文标题】:i need check if one note is under 95 with function我需要检查一个音符是否低于 95 并具有功能 【发布时间】:2019-04-10 22:10:01 【问题描述】:

我需要创建一个函数,如果一个学生在一个会话中的所有笔记都超过 94 所以 95 或更多,我返回 true

它在 plsql oracle 上。 我尝试了很多东西,请帮助我

create or replace function BonnePerformance (CodeP in char, CodeS in char)
return boolean is
declare 
    noteMauvaise integer;
begin
    select Min(note) into noteMauvaise
    from Inscription 
    where codePermanent = CodeP and codeSession = CodeS ;
    if  noteMauvaise < 95 then
        return false;
    else
        return true;
    end if;
end;
/

如果学生的这个功能是真的,我也将它添加到一个好学生列表并打印出来。

对不起,我的英语是法语

【问题讨论】:

好的,很好。但问题是什么? 函数没有编译 【参考方案1】:

编译错误是由declare 关键字引起的。无需在函数内部使用declare。请尝试以下代码。希望这能正常工作。

create or replace function BonnePerformance (CodeP in char, CodeS in char)
return boolean is
    noteMauvaise integer;
begin
    select Min(note) into noteMauvaise
    from Inscription 
    where codePermanent = CodeP and codeSession = CodeS ;
    if  noteMauvaise < 95 then
        return false;
    else
        return true;
    end if;
end;
/

【讨论】:

以上是关于我需要检查一个音符是不是低于 95 并具有功能的主要内容,如果未能解决你的问题,请参考以下文章