3 Replies - 2848 Views - Last Post: 02 September 2014 - 04:51 PM

#1 ILoveJava  Icon User is offline

  • D.I.C Regular

Reputation: 29
  • View blog
  • Posts: 389
  • Joined: 12-March 12

PL/SQL Procedures

Posted 24 May 2014 - 07:31 PM

Hey guys, so I'm doing a mid-year PL/SQL assessment, it's all based around a library database system, and we need to create a procedure to extend the book loan by 3 weeks. I've set it up as best I can, but the vagueness of the errors is getting to me. Is anyone able to give me a pointer on where I'm doing wrong?
CREATE OR REPLACE PROCEDURE extend_loan(p_code IN CHAR) AS
   v_name char(5);
BEGIN
   SELECT book_title INTO v_name
	FROM catalogue WHERE book_code = p_code;
   DBMS_OUTPUT.PUT_LINE('Extending ' || v_name || ' by 3 weeks (21 days');
   UPDATE loan
	SET due_date = (sysdate + 21)
        WHERE book_code = p_code;
   DBMS_OUTPUT.PUT_LINE(v_name || ' is now due on ' || due_date);
EXCEPTION
   WHEN NO_DATA_FOUND THEN
   DBMS_OUTPUT.PUT_LINE('Invalid book code ' || p_code);
END;


Is This A Good Question/Topic? 0
  • +

Replies To: PL/SQL Procedures

#2 idunno  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 10-October 11

Re: PL/SQL Procedures

Posted 02 September 2014 - 04:57 AM

add commit; after the update statement
Was This Post Helpful? 0
  • +
  • -

#3 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 592
  • View blog
  • Posts: 3,823
  • Joined: 12-January 10

Re: PL/SQL Procedures

Posted 02 September 2014 - 06:53 AM

also show the errors
Was This Post Helpful? 0
  • +
  • -

#4 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1786
  • View blog
  • Posts: 5,697
  • Joined: 15-January 14

Re: PL/SQL Procedures

Posted 02 September 2014 - 04:51 PM

Do you have 2 accounts or something? What exactly are the errors?

Never mind, I completely read that reply the wrong way.

This post has been edited by ArtificialSoldier: 02 September 2014 - 04:51 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1