I am very new to using PL/SQL and I have created a procedure but I cannot figure out the correct syntax in order to get the current month and year's data and another cursor to get the data from exactly 1 year prior:
create or replace procedure data(acc integer, month integer, year integer)
as
Cursor c1 is
select usage
from bill
where account =acc_num and to_char(BILL_DATE, 'MM-YYYY') = 'month-year';
Cursor c3 is
select usage
from bill
where account =acc_num and
to_char(BILL_DATE, 'MM-YYYY') = 'month-year' - 1;
** I do understand this is only part of the code, but I believe my logic is almost complete for finding the data I want. Using PLSQL