mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
create helper procedure to insert an item
This commit is contained in:
parent
1ad3fcd95e
commit
66495cb872
9
plsql/new_item.sql
Normal file
9
plsql/new_item.sql
Normal file
@ -0,0 +1,9 @@
|
||||
CREATE OR REPLACE PROCEDURE new_item(
|
||||
i_name item.name%TYPE,
|
||||
i_sell_in item.sell_in%TYPE,
|
||||
i_quality item.quality%TYPE)
|
||||
IS
|
||||
BEGIN
|
||||
INSERT INTO item (name, sell_in, quality) VALUES (i_name, i_sell_in, i_quality);
|
||||
END new_item;
|
||||
/
|
||||
@ -1,17 +1,5 @@
|
||||
DELETE FROM item;
|
||||
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('+5 Dexterity Vest', 10, 20);
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('Aged Brie', 2, 0);
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('Elixir of the Mongoose', 5, 7);
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('Sulfuras, Hand of Ragnaros', 0, 80);
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('Sulfuras, Hand of Ragnaros', -1, 80);
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('Backstage passes to a TAFKAL80ETC concert', 15, 20);
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('Backstage passes to a TAFKAL80ETC concert', 10, 49);
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('Backstage passes to a TAFKAL80ETC concert', 5, 49);
|
||||
-- this conjured item does not work properly yet ;
|
||||
INSERT INTO item (name, sell_in, quality) VALUES ('Conjured Mana Cake', 3, 6);
|
||||
COMMIT;
|
||||
|
||||
DECLARE
|
||||
l_days NUMBER(3);
|
||||
CURSOR c_items IS
|
||||
@ -20,6 +8,17 @@ DECLARE
|
||||
BEGIN
|
||||
DBMS_OUTPUT.PUT_LINE('OMGHAI!');
|
||||
|
||||
new_item('+5 Dexterity Vest', 10, 20);
|
||||
new_item('Aged Brie', 2, 0);
|
||||
new_item('Elixir of the Mongoose', 5, 7);
|
||||
new_item('Sulfuras, Hand of Ragnaros', 0, 80);
|
||||
new_item('Sulfuras, Hand of Ragnaros', -1, 80);
|
||||
new_item('Backstage passes to a TAFKAL80ETC concert', 15, 20);
|
||||
new_item('Backstage passes to a TAFKAL80ETC concert', 10, 49);
|
||||
new_item('Backstage passes to a TAFKAL80ETC concert', 5, 49);
|
||||
-- this conjured item does not work properly yet ;
|
||||
new_item('Conjured Mana Cake', 3, 6);
|
||||
|
||||
l_days := 2;
|
||||
|
||||
FOR i IN 0 .. l_days - 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user