Write a PL/SQL to update the rate field by 20% more than the current rate
in inventory table which has the following fields: Prono, ProName and
Rate. After updating the table a new field (Alter) called for Number of item
and place for values for the new field without using PL/SQL block
QUERY
CREATE TABLE Inventory (
Prono NUMBER PRIMARY KEY,
ProName VARCHAR2(30),
Rate NUMBER
);
INSERT INTO Inventory VALUES (1, 'Pen', 10);
INSERT INTO Inventory VALUES (2, 'Book', 50);
INSERT INTO Inventory VALUES (3, 'Pencil', 5);
COMMIT;
SELECT * FROM Inventory;
BEGIN
UPDATE Inventory
SET Rate = Rate * 1.20;
COMMIT;
END;
SELECT * FROM Inventory;
ALTER TABLE Inventory
ADD Alter_No NUMBER;
UPDATE Inventory
SET Alter_No = 101
WHERE Prono = 1;
UPDATE Inventory
SET Alter_No = 102
WHERE Prono = 2;
UPDATE Inventory
SET Alter_No = 103
WHERE Prono = 3;
COMMIT;
SELECT * FROM Inventory;