PLSQL打开游标

显示打开游标
--定义游标并指定对应的查询
CURSOR c_roleinfo IS                                     
    SELECT y.roleid, y.name
      FROM T_BME_ROLE y;

for v_role in c_roleinfo loop
       //todo
end loop;



隐式打开游标
-- 直接打开游标,指定对应的查询
 for privilegeInfo in 
          (select k.objecttype,k.objectid
             from t_bme_role_privilege l , t_bme_privilege k 
            where  l.roleid = str_roleid     
              and  l.privilegeid = k.privilegeid ) loop

        //todo
       dbms_ouput.put_line(privilegeInfo.objecttype); 
 end loop;


你可能感兴趣的:(sql,C++,c,C#)