存储过程中的多个IN参数

时间:2013-11-22 01:17:06

标签: sql oracle stored-procedures

我有一个存储过程,我用它来进行查询。此查询从几个不同的表和视图中收集信息,并将信息一起编译。但是,现在我只能获取一个IN参数的过程。我想编辑它以获取两个IN参数,以便我可以收集更多特定信息。

CREATE OR REPLACE PROCEDURE gradeReportProcedure(p_courseNo IN varchar2)
IS 
    var_Sname       finalscores.Name%TYPE;
    var_courseNo        finalscores.courseNo%TYPE;
    var_sectionNo       finalscores.secNo%TYPE;
    var_title       course.title%TYPE;
    var_score       finalscores.score%TYPE;
    var_lettergrade     gradeploicy.letterade%TYPE;
    var_Ins_fname       inst.fname%TYPE;
    var_Ins_lname       inst.lname%TYPE;


CURSOR AverageCursor IS

    select distinct finalscores.NAME, finalscores.COURSENO, finalscores.secNo, course.TITLE, round(finalscores.SCORE,2), gradeploicy.LETTERADE, INST.FNAME, INST.LNAME
    from finalscores, gradeploicy, course, INST
    where finalscores.COURSENO = course.COURSENO
    and finalscores.SCORE between gradeploicy.LOWBOUND and gradeploicy.UPPBOUND
    AND INST.INS_NO = course.INS_NO;

begin
    open AverageCursor;

    FETCH AverageCursor
          INTO var_Sname, var_courseNo, var_sectionNo, var_title, var_score, var_lettergrade, var_Ins_fname, var_Ins_lname;


   [Formatting and information that needs to be omitted]


    LOOP

    FETCH AverageCursor
      INTO var_Sname, var_courseNo, var_sectionNo, var_title, var_score, var_lettergrade, var_Ins_fname, var_Ins_lname;
    EXIT WHEN AverageCursor%NOTFOUND;


    dbms_output.put_line(var_Sname||' '||var_score||'       '||var_lettergrade);
    dbms_output.put_line(' ');

END LOOP;
END;
/

0 个答案:

没有答案