PLSQL – A stored procedure that allows a user to lend multiple books to a borrower

I’m having a lot of trouble trying to work this out. Essentially, I’m trying to create a procedure in Oracle SQL Developer which enables two books to be lent out to a borrower. The tables and values are correctly setup. I feel like my created procedure may be pretty close (on the right track), but I get confused about the syntax, especially with the dates and when trying to call the procedure.

There are a few other related tables in the schema, but the gist is I’m trying to insert library/borrower records into a table called loan. The values being inserted are: 2x isbn, branchid, cardno, dateout (when book/s are borrowed) and datein (null by default, until book/s are returned). These are the column names in the loan table.

This is the procedure I’ve been working on. Please bare with me I am an SQL beginner:

create or replace procedure BorrowTwoBooks(
p_isbn in varchar2,
p_isbn2 in varchar2,
p_branchid in number,
p_cardno in number
pDate Date Default SysDate;
    insert into loan values(p_isbn, p_branchid, p_cardno, pDate, null);
    insert into loan values(p_isbn2, p_branchid, p_cardno, pDate, null);
end BorrowTwoBooks;

and this is an example of how I’d try to call the procedure once it’s created:


where I’m hoping the syntax would be:


Any help would be greatly appreciated. This is my first post, thanks everyone in advance for the help. :)

for your procedure the syntax would be:


try to call:

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » PLSQL – A stored procedure that allows a user to lend multiple books to a borrower

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录