如何在游標c_employees內聲明其他游標?
注意:游標c_employees返回employess_id,這個id傳遞給where子句中的另一個游標。
For example
cursor c_employees
is
Select employees_id from employees;
begin
for e in c_employees loop
begin
--How here define other cursor from cursor_employees I get employess_id and put as parameter.
cursor c_leaves is Select hours from my_table where employess_id = e.employess_id;
for j in c_leaves loop
begin
Insert into table2(......
end;
end loop;
因此,游標可以獲取參數
但是一般來說,當您開始看到帶有游標等etc...its的游標時,也需要考慮是否可以用聯接替換查詢。例如,上面的代碼可能只是