From 66495cb8721e11a41d57db9cd269b32c4e3f0a86 Mon Sep 17 00:00:00 2001 From: Peter Kofler Date: Sun, 13 Apr 2014 15:21:47 +0200 Subject: [PATCH] create helper procedure to insert an item --- plsql/new_item.sql | 9 +++++++++ plsql/texttest_fixture.sql | 23 +++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 plsql/new_item.sql diff --git a/plsql/new_item.sql b/plsql/new_item.sql new file mode 100644 index 00000000..63c46fe7 --- /dev/null +++ b/plsql/new_item.sql @@ -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; +/ diff --git a/plsql/texttest_fixture.sql b/plsql/texttest_fixture.sql index ce56ff25..59a8f39c 100644 --- a/plsql/texttest_fixture.sql +++ b/plsql/texttest_fixture.sql @@ -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