Review the code below then answer the questions that follow. LINE NUMBER 1 Create or replace Function House_Details(h_num in townhouse.house_num%Type) 2 RETURN vorchar2 3 IS 4 details varchar(100); 5...


Defend the use of a function instead of a procedure using examples from the query.


Review the code below then answer the questions that follow.<br>LINE<br>NUMBER<br>1<br>Create or replace Function House_Details(h_num in townhouse.house_num%Type)<br>2<br>RETURN vorchar2<br>3<br>IS<br>4<br>details varchar(100);<br>5<br>cursor c1 is<br>select c.cust_id ||R'|| t.build_price ||,'Il pa.purchase_date ||'Il pa.purchase_amt<br>6<br>from CUSTOMER C, TOWNHOUSE t, PURCHASE_AGREEMENT pa<br>where c.cust_id = pa.cust_id<br>and t.house_num = pa.house_num<br>10<br>and t.house_num = h_num;<br>11<br>BEGIN<br>12<br>open c1;<br>13<br>fetch cl into details;<br>14<br>if c1%notfound then<br>15<br>details := 'No house information found;<br>16<br>end if:<br>17<br>RETURN details;<br>18<br>close c1;<br>19<br>EXCEPTION<br>20<br>WHEN OTHERS THEN<br>21<br>raise_application_error(-20001, 'An error was encountered - '||SQLCODE||'-ERROR-<br>22<br>'1/SQLERRM);<br>23<br>END;<br>24<br>25<br>select House_Details(3) from dual;<br>

Extracted text: Review the code below then answer the questions that follow. LINE NUMBER 1 Create or replace Function House_Details(h_num in townhouse.house_num%Type) 2 RETURN vorchar2 3 IS 4 details varchar(100); 5 cursor c1 is select c.cust_id ||R'|| t.build_price ||,'Il pa.purchase_date ||'Il pa.purchase_amt 6 from CUSTOMER C, TOWNHOUSE t, PURCHASE_AGREEMENT pa where c.cust_id = pa.cust_id and t.house_num = pa.house_num 10 and t.house_num = h_num; 11 BEGIN 12 open c1; 13 fetch cl into details; 14 if c1%notfound then 15 details := 'No house information found; 16 end if: 17 RETURN details; 18 close c1; 19 EXCEPTION 20 WHEN OTHERS THEN 21 raise_application_error(-20001, 'An error was encountered - '||SQLCODE||'-ERROR- 22 '1/SQLERRM); 23 END; 24 25 select House_Details(3) from dual;

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here