Question

I have used the following code to create a procedure:

DELIMITER //
CREATE procedure GetBooksbyBorrowerID (IN Bor_id VARCHAR(10))
BEGIN
SELECT borrower_details.Borrower_ID ,borrower_details.Book_ID, book_mst.book_Title,book_mst.LANGUAGE, borrower_details.borrowed_from_date 
FROM borrower_details 
JOIN book_mst
ON borrower_details.BOOK_ID = book_mst.ISBN
WHERE (borrower_details.borrower_id = 'Bor_id');
END //

When I call this procedure, it says Mysql query executed successfully, but does not show the output records. And there are records in the database that match the criteria in the query. I use the following statement to call:

CALL GetBooksbyBorrowerID ('BOR001');

What should I do to view the output records?

Was it helpful?

Solution

You are comparing borrower_details.borrower_id with the string 'Bor_id' and not the parameter.

Use WHERE (borrower_details.borrower_id = Bor_id);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top