oracle的函数,where条件能否动态?

假设现在有这么一个函数

CREATE OR REPLACE FUNCTION fc_student_list (
    student_name1    IN   VARCHAR2 DEFAULT '',
    score1      IN   NUMBER DEFAULT 0

里面有这个一个语句:

select a.* from class a where a.student_name=student_name1 and a.score>score1;

能否让这个语句做成如果没传其中某个入参,就自动忽略对应的where条件?

在mybatis中,where 1 = 1 ,后面可以使用if标签判断 有参数,就对应and ......

  1. if  para is null  then
    "where sql"
    elsif para is not null  then
    "not where sql"
    end if;