Your colleague, John, has been struggling with a PL/SQL query that should display the Customer ID and the House Number, including the Materials used in the construction of the townhouses. John doesn’t seem to be able to determine why the query is not working and has asked for yourassistance.
Identify the errors and re‐write the correct code:
set serveroutput on c_id CUSTOMER.cust_id%Type; t TOWNHOUSE.house_num%Type; m_name MATERIALS.material_name%Type;cursor info isselect cu.cust_id, t.house_num, m.material_namefrom CUSTOMER cu, TOWNHOUSE t, MATERIALS m, PURCHASE_AGREEMENT pawhere cu.cust_id = pa.cust_idand t.house_num = pa.house_numand m.material_id = pa.material_idbeginfor rec in info c_id:=rec.cust_id; t:= rec.house_num; m_name:=rec.material_name; dbms_output_put_line('CUSTOMER ID: ' || c_id || ', ' || chr(13) ||'HOUSE NUM: ' || t ||chr(13) || 'MATERIALS: ' || m_name); dbms_output.put_line('‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐');end loop;
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here