PL/SQL cursor problem in procedure
I have stored procedure.In procedure there开发者_如何学Go are three cursors.I have to run procedure daily in production.I want only two cursors should run daily and the remaining cursor should run only on 1st of every month.So what are the changes should be made to third cursor.Please provide the solution.
The cursor itself doesn't actually run. It is your code that uses the cursor. So you can check in code if it is the first day of the month:
-- Check if today is first day of the month
if trunc(sysdate, 'MM') = trunc(sysdate) then
-- Use cursor here
end if;
Possibly a better solution is to create two separate procedures and create jobs for each of them. You can specify intervals for the job so one runs daily while the other runs monthly.
Look into dbms_scheduler
精彩评论