oracle程序块

1.匿名语句

DECLARE
    v_subject number := 0;
 BEGIN
   for v in (select id,sex,age from student) loop
     
      select count(*) into v_subject from subject where studentid = v.id;
      
      if v_subject < 1 then 
        --没报考的
        continue;
      end if;
      
      dbms_output.put_line('学生报考科目:'||v_subject);
     
   end loop;
   
 end;

 

posted @ 2022-03-22 17:48  N神3  阅读(44)  评论(0编辑  收藏  举报