Print a single formatted record - Set echo on - Set up a spool file to receive your output for submission. I would suggest c:\cs4210\WA4spool.txt . - SET SERVEROUTPUT ON - DECLARE a record variable (Emp_rec) using %ROWTYPE - In the BEGIN block use INTO to load a record into the declared variables for HR.EMPLOYEES for Employee_ID = 114 - Use a CASE statement to print the associated Department Name for Department_ID - Add DBMS_OUTPUT lines to print each variable for the selected record - Use TO_CHAR to format Salary as 999,999.00 - Add an EXCEPTION block to report when no data is found - Compile and run the procedure - Close the spool file
Print a single formatted record
- Set echo on
- Set up a spool file to receive your output for submission. I would suggest c:\cs4210\WA4spool.txt .
- SET SERVEROUTPUT ON
- DECLARE a record variable (Emp_rec) using %ROWTYPE
- In the BEGIN block use INTO to load a record into the declared variables for HR.EMPLOYEES for Employee_ID = 114
- Use a CASE statement to print the associated Department Name for Department_ID
- Add DBMS_OUTPUT lines to print each variable for the selected record
- Use TO_CHAR to format Salary as 999,999.00
- Add an EXCEPTION block to report when no data is found
- Compile and run the procedure
- Close the spool file
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
I got this error when running code:
DBMS_OUTPUT.PUT_LINE('Job Title: ' || Emp_rec.Job_Title);
*
ERROR at line 24:
ORA-06550: line 24, column 49:
PLS-00302: component 'JOB_TITLE' must be declared
ORA-06550: line 24, column 3:
PL/SQL: Statement ignored