Your colleague, John, has been struggling with a PL/SQL query that should
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

Your colleague, John, has been struggling with a PL/SQL query that should

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 your assistance. 

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 is

select cu.cust_id, t.house_num, m.material_name

from CUSTOMER cu, TOWNHOUSE t, MATERIALS m, PURCHASE_AGREEMENT pa

where cu.cust_id = pa.cust_id

and t.house_num = pa.house_num

and m.material_id = pa.material_id

begin

for 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;

tables-used

Hint
ComputerSQL stands for the Structured Query Language. It is a domain-specific language that is used in the programming. They are usually designed for the management data that are held in a relational database management system. They are also even designed for the stream processing in a relational data stream management system....

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.