Learning Goal: I’m working on a mysql multi-part question and need the explanation and answer to help me learn.
Needing a code and spool output for this as well. It uses the same database as the last project you did for me, but I attached them again in case. The spool output is the most important. Here are the instructions:
- SPOOL your output to c:\folder\project6spool.txt
- Set SERVEROUTPUT ON FORMAT WRAPPED to use the
DBMS_OUTPUT package and preserve leading spaces - Declare variables for the entire record using %ROWTYPE
Add a variable to remember last ROOMNUM
Add accumulators for subtotal and grandtotal - Add procedures for HEAD_OF_FORM, FORM_BREAK, and END_OF_FORM
- Use FOR/IN to read all records from DDI.LEDGER_VIEW
- The SELECT statement should read all fields from DDI.LEDGER_VIEW
where REGDATE < ’08-JUN-15′ (Monday Γ’β¬β Friday for Week One)
order by ROOMNUM and REGDATE - Read each record using LOOP/END LOOP
Use IF/ELSEIF/ELSE/END IF to decide which procedures to use based on Last_room
Print ROOMNUM, REGDATE, REGID, Name (FIRSTNAME || ‘ ‘ || LASTNAME), ROOMRATE
using TO_CHAR to format REGDATE as ‘MM/DD/YYYY’ and ROOMRATE as ‘999,999.00’ - Be sure to add a FORM_BREAK and an END_OF_FORM after the END LOOP
- Use DBMS__OUTPUT.OUTPUT_LINE to print the values for each field
concatenate FIRSTNAME and LASTNAME into a single name and use”
TO_CHAR to format dates as ‘MM/DD/YYYY’ and currency as ‘999,999.00’ - Compile and run the procedure
- Close spool