I need to update a quantity in to my database. I tried with a update statement, (trigger oracle, don't work because definitely something wrong)
My sql string is:
String sql1 = "update book set qty = qty - 1 where isbn='" + txt_carr.getText() + "'";
txt_carr is a txtField where I write a isbn (for add a cart), but the quantity don't change for that precise ISBN.
Also in the cart when you close the program, should update the quantity (even at a fixed, for example 5)
I tried this:
String sql3= "UPDATE book SET quantity= 5 (select isbn cart where isbn=) ";
Where isbn = to all isbn in your cart. So it should only update the quantity (in table book) of the books in the shopping cart and not all.
I know that a trigger would work much better, but do not know how to write it.