I m try to solve this problem
Add a column named *reorder_quanity* to the *books* table that will hold a value up to 999 with a default value of 10.
4. Update the reorder quantity of all books to 10.
5. Update the quantity ordered to 1 for all books pending shipment.
This is my code:(
when run my code this error i m getting
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 9
ALTER TABLE books
ADD(reorder_quantity NUMBER(3) DEFAULT 10);
CREATE TABLE reorder(REORDER# number(6) not null,REORDER_DATE Date,ISBN VARCHAR(10),QUANTITY INT,RECEIPT_DATE Date);
ALTER TABLE reorder ADD primary key (REORDER#);
ALTER TABLE reorder ADD CONSTRAINT fk_rerOrders FOREIGN KEY (ISBN)
REFERENCES books(ISBN);
DECLARE
lv_title_txt books.title%TYPE;
lv_reorder_num books.reorder_quantity%TYPE;
lv_shipdate_date orders.order#%TYPE;
BEGIN
SELECT DISTINCT title,reorder_quantity
INTO lv_title_txt,lv_reorder_num
FROM books JOIN orderitems USING(isbn)
WHERE order# IN
(SELECT order#
FROM orders
WHERE shipdate IS NULL);
IF lv_shipdate_date = NULL THEN
UPDATE books
SET reorder_quantity = 1;
END IF;
END;