Q1: You have the following tables:Book (ISBN, title, edition)Member (ID, m_name, age)ReserveBook (I_SBN, i_d, date)Create a procedure that accept the book title and list all the member names that borrowed this book. The procedureshould return error message if title is missing or not found.create or replace procedure listmembers(tit in book.title%type)Ascnt number;names varchar2(100);CURSOR borrow_members ISselect m_name into names from member, book, reservebook where reservebook.id=member.ID andbook.ISBN=reservebook.ISBN and title=tit;beginselect count(*) into cnt from book where title=tit;if tit is nullthenbegindbms_output.put_line('title is null');return;end;end if;if cnt=0thenbegindbms_output.put_line('title doesnt exists');return;end;end if;OPEN borrow_members;LOOPFETCH borrow_members INTO names;EXIT WHEN borrow_members %NOTFOUND;dbms_output.put_line(names||' borrowed'||' '||tit);END LOOP;CLOSE borrow_members;end listmembers;beginlistmembers('db');end;Q2: You have the following tables:Hotel (H_id, h_name, contactperson)Room (R_id, Floor_no, occupied)
You've reached the end of your free preview.
Want to read both pages?
Following,Articles with example SQL code,Stored procedure,following tables