CaesarII Posted August 6, 2012 Share Posted August 6, 2012 Hello all, I’m using oracle 10g forms builder to create dvd rental system, the problem I’m having is calculating the overdue fine. I already have the date the dvd is rented out, $$date$$, and the date due, sysdate + 7 (i.e. 7 days after date out), i however as perversely stated have no idea how to calculate the fine (which is charged at £2.00 a day) and any help would be appreciated. Thanks, CaesarII Link to comment Share on other sites More sharing options...
niche Posted August 6, 2012 Share Posted August 6, 2012 It would be an if statement: http://w3schools.com/php/php_if_else.asp However, they're not very perverse. lol Link to comment Share on other sites More sharing options...
CaesarII Posted August 6, 2012 Author Share Posted August 6, 2012 whilst helpfull and gave me other ideas it did not help me solve my original problem, thanks though Link to comment Share on other sites More sharing options...
niche Posted August 6, 2012 Share Posted August 6, 2012 How far have you got on your if statement? Please post what you have. Link to comment Share on other sites More sharing options...
CaesarII Posted August 7, 2012 Author Share Posted August 7, 2012 This is what i have so far; if (date returned < date out) { SELECT DATEDIFF (day,'RENTAL_CARD.TEXT_ITEM_DATE_RETURNED',''RENTAL_CARD.TEXT_ITEM_DATE_RETURNED') AS DiffDate*2; }; Link to comment Share on other sites More sharing options...
niche Posted August 7, 2012 Share Posted August 7, 2012 (edited) I forgot this is in the sql forum so the if becomes a WHERE. So, your code would look something like this: "UPDATE table SET fine = 2 WHERE TIMESTAMP(NOW()) BETWEEN TIMESTAMP(rental_date) AND TIMESTAMP(WEEK,1,rental_date) AND customer_id = '$customer_id_selected" Edited August 7, 2012 by niche Link to comment Share on other sites More sharing options...
CaesarII Posted August 7, 2012 Author Share Posted August 7, 2012 Changing the formula to fit my precise table and field names is going well (however oracle doesn’t seem to like timestamp), I’m off home for the evening and I’ll continue more tomorrow Link to comment Share on other sites More sharing options...
niche Posted August 7, 2012 Share Posted August 7, 2012 The sql I know is mysql. Perhaps, someone else can help that knows the oracle version. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now