Question

PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create...

PL/SQL Auction Program

1. Create a user xyz, who is the owner of the auction. Create the schema, and package.

2. Create users x1 and x2 who are the participants in the auction. They will need acces to the package.

3. Bid on the same item and record your observations. Verify all scenarios. Upload the files with the missing code and a detailed sample run.

AUCTION OWNER.TXT

SQL> conn / as sysdba

Connected.
SQL> drop user xyz cascade;

User dropped.

SQL> drop user x1 cascade;

User dropped.

SQL> drop user x2 cascade;

User dropped.

SQL> create user xyz identified by xyz account unlock quota 25M on users;

User created.

SQL> grant connect,resource to xyz;

Grant succeeded.

SQL> grant execute on dbms_alert to xyz;

Grant succeeded.

SQL> grant create view to xyz;

Grant succeeded.

SQL> create user x1 identified by x1 account unlock;

User created.

SQL> grant connect,resource to x1;

Grant succeeded.

SQL> create user x2 identified by x2 account unlock;

User created.

SQL> grant connect,resource to x2;

Grant succeeded.


SQL> conn xyz/xyz
Connected.
SQL> DROP VIEW high_bids;
DROP VIEW high_bids
*
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> DROP TABLE bids;
DROP TABLE bids
*
ERROR at line 1:
ORA-00942: table or view does not exist


SQL> DROP TABLE auction_items;
DROP TABLE auction_items
*
ERROR at line 1:
ORA-00942: table or view does not exist


SQL>
SQL> CREATE TABLE auction_items
2 (id VARCHAR2(20) NOT NULL PRIMARY KEY
3 ,description VARCHAR2(200) NOT NULL
4 ,min_bid NUMBER NOT NULL
5 ,curr_bid NUMBER
6 ,status VARCHAR2(10)
7 CONSTRAINT valid_status
8 CHECK (status IN ('OPEN','CLOSED') )
9 );

Table created.

SQL>
SQL> CREATE TABLE bids
2 (bidder VARCHAR2(30)
3 ,item_id VARCHAR2(20)
4 REFERENCES auction_items(id)
5 ON DELETE CASCADE
6 ,bid NUMBER NOT NULL
7 );

Table created.

SQL>
SQL> CREATE OR REPLACE VIEW high_bids
2 (item_id
3 ,item_desc
4 ,bidder
5 ,high_bid)
6 AS
7 SELECT
8 BID.item_id
9 ,AI.description
10 ,BID.bidder
11 ,BID.bid
12 FROM
13 bids BID
14 ,auction_items AI
15 WHERE
16 BID.item_id = AI.id
17 AND BID.bid = (SELECT MAX(bid)
18 FROM bids B2
19 WHERE BID.item_id = B2.item_id)
20 /

View created.

SQL>
SQL> -- End Auction.sql
SQL> --Auction1
SQL> CREATE OR REPLACE PACKAGE auction
2 /*
3 || Implements a simple interactive bidding system
4 || using DBMS_ALERT to keep bidders informed
5 || of activity in items they are interested in.
6 ||
7 || The item_id is used as the ALERT name for the
8 || item.
9 ||
10 ||
11 || Compilation Requirements:
12 ||
13 || EXECUTE on DBMS_ALERT
14 || SELECT, UPDATE on AUCTION_ITEMS
15 || INSERT on BIDS
16 || SELECT on HIGH_BIDS
17 ||
18 || Execution Requirements:
19 ||
20 */
21 AS
22 /*
23 || exceptions raised and handled in PLACE_BID
24 || procedure
25 */
26 invalid_item EXCEPTION;
27 bid_too_low EXCEPTION;
28 item_is_closed EXCEPTION;
29
30 /*
31 || place a bid on an item, the bid must exceed any
32 || other bids on the item (and the minimum bid)
33 ||
34 || bidding on an item registers interest in the
35 || item using DBMS_ALERT.REGISTER
36 ||
37 || only this procedure should be used to add rows
38 || to the bids table, since it also updates
39 || auction_items.curr_bid column
40 */
41 PROCEDURE place_bid
42 (item_id_IN IN VARCHAR2
43 ,bid_IN IN NUMBER);
44
45 /*
46 || close bidding on an item
47 */
48 PROCEDURE close_item(item_id_IN IN VARCHAR2);
49
50 /*
51 || watch for any alerts on items bid by the user
52 || indicating other users have raised the bid
53 */
54 PROCEDURE watch_bidding(timeout_secs_IN IN NUMBER:=300);
55
56 END auction;
57 /

Package created.

SQL>
SQL> CREATE OR REPLACE PACKAGE BODY auction
2 AS
3
4 FUNCTION curr_bid(item_id_IN IN VARCHAR2)
5 RETURN NUMBER
6 IS
7 temp_bid NUMBER;
8 BEGIN
9 SELECT curr_bid
10 INTO temp_bid
11 FROM auction_items
12 WHERE id = item_id_IN;
13
14 RETURN temp_bid;
15
16 EXCEPTION
17 WHEN OTHERS
18 THEN RETURN NULL;
19 END curr_bid;
20
21 PROCEDURE place_bid
22 (item_id_IN IN VARCHAR2
23 ,bid_IN IN NUMBER)
24 IS
25 temp_curr_bid auction_items.curr_bid%TYPE;
26 temp_status auction_items.status%TYPE;
27
28 CURSOR auction_item_cur
29 IS
30 SELECT NVL(curr_bid,min_bid), status
31 FROM auction_items
32 WHERE id = item_id_IN
33 FOR UPDATE OF curr_bid;
34
35 BEGIN
36 /*
37 || lock row in auction_items
38 */
39 OPEN auction_item_cur;
40 FETCH auction_item_cur INTO temp_curr_bid, temp_status;
41
42 /*
43 || do some validity checks
44 */
45 IF auction_item_cur%NOTFOUND
46 THEN
47 RAISE invalid_item;
48
49 ELSIF temp_status = 'CLOSED'
50 THEN
51 RAISE item_is_closed;
52
53 ELSIF bid_IN <= temp_curr_bid
54 THEN
55 RAISE bid_too_low;
56
57 ELSE
58 /*
59 || insert to bids AND update auction_items,
60 || bidders identified by session username
61 */
62 INSERT INTO bids (bidder, item_id, bid)
63 VALUES (USER, item_id_IN, bid_IN);
64
65 UPDATE auction_items
66 SET curr_bid = bid_IN
67 WHERE CURRENT OF auction_item_cur;
68
69 /*
70 || commit is important because it will send
71 || the alert notifications out on the item
72 */
73 COMMIT;
74
75 /*
76 || register for alerts on item since bidding,
77 || register after commit to avoid ORU-10002
78 */
79 DBMS_ALERT.REGISTER(item_id_IN);
80
81 END IF;
82
83 CLOSE auction_item_cur;
84
85 EXCEPTION
86 WHEN invalid_item
87 THEN
88 ROLLBACK WORK;
89 RAISE_APPLICATION_ERROR
90 (-20002,'PLACE_BID ERR: invalid item');
91 WHEN bid_too_low
92 THEN
93 ROLLBACK WORK;
94 RAISE_APPLICATION_ERROR
95 (-20003,'PLACE_BID ERR: bid too low');
96 WHEN item_is_closed
97 THEN
98 ROLLBACK WORK;
99 RAISE_APPLICATION_ERROR
100 (-20004,'PLACE_BID ERR: item is closed');
101 WHEN OTHERS
102 THEN
103 ROLLBACK WORK;
104 RAISE;
105 END place_bid;
106
107 PROCEDURE close_item(item_id_IN IN VARCHAR2)
108 IS
109 BEGIN
110 UPDATE auction_items
111 SET status = 'CLOSED'
112 WHERE id = item_id_IN;
113
114 /* commit to raise alert */
115 COMMIT WORK;
116 END close_item;
117
118 PROCEDURE watch_bidding(timeout_secs_IN IN NUMBER:=300)
119 IS
120 temp_name VARCHAR2(30);
121 temp_message VARCHAR2(1800);
122 temp_status INTEGER;
123 BEGIN
124 /*
125 || enter a loop which will be exited explicitly
126 || when a new bid from another user received or
127 || DBMS_ALERT.WAITANY call times out
128 */
129 LOOP
130 /*
131 || wait for up to 10 minutes for any alert
132 */
133 DBMS_ALERT.WAITANY
134 (temp_name, temp_message, temp_status, timeout_secs_IN);
135
136 IF temp_status = 1
137 THEN
138 /*
139 || timed out, return control to application
140 || so it can do something here if necessary
141 */
142 EXIT;
143
144 ELSIF temp_message = 'CLOSED'
145 THEN
146 /*
147 || unregister closed item, re-enter loop
148 */
149 DBMS_ALERT.REMOVE(temp_name);
150 DBMS_OUTPUT.PUT_LINE('Item '||temp_name||
151 ' has been closed.');
152
153 ELSIF temp_message = USER OR temp_message = 'OPEN'
154 THEN
155 /*
156 || bid was posted by this user (no need to alert)
157 || re-enter loop and wait for another
158 */
159 NULL;
160
161 ELSE
162 /*
163 || someone raised the bid on an item this user is bidding
164 || on, application should refresh user's display with a
165 || query on the high_bids view and/or alert visually
166 || (we will just display a message)
167 ||
168 || exit loop and return control to user so they can bid
169 */
170 DBMS_OUTPUT.PUT_LINE
171 ('Item '||temp_name||' has new bid: '||
172 TO_CHAR(curr_bid(temp_name),'$999,999.00')||
173 ' placed by: '||temp_message);
174 EXIT;
175 END IF;
176 END LOOP;
177
178 END watch_bidding;
179
180 END auction;
181 /

Package body created.

SQL>
SQL> --End auction1.sql
SQL> --Auction2.sql
SQL>
SQL> CREATE OR REPLACE TRIGGER auction_items_ARU
2 AFTER UPDATE ON auction_items
3 FOR EACH ROW
4 BEGIN
5 /*
6 || trigger enforces no update of item_id and also
7 || signals an alert when status changes
8 */
--Supply missing code.
18 END auction_items_ARU;
19 /

Trigger created.

SQL>
SQL> CREATE OR REPLACE TRIGGER bids_ARIUD
2 AFTER INSERT OR UPDATE OR DELETE ON bids
3 FOR EACH ROW
4 BEGIN
5 /*
6 || enforce all bids are final rule
7 */
8 --Supply missing code.
18
19 END bids_ARIUD;
20 /

Trigger created.

SQL> CREATE OR REPLACE TRIGGER auction_items_ARU
2 AFTER UPDATE ON auction_items
3 FOR EACH ROW
4 BEGIN
5 /*
6 || trigger enforces no update of item_id and also
7 || signals an alert when status changes
8 */
9 --Supply missing code.
18 END auction_items_ARU;
19 /

Trigger created.

SQL>
SQL> CREATE OR REPLACE TRIGGER bids_ARIUD
2 AFTER INSERT OR UPDATE OR DELETE ON bids
3 FOR EACH ROW
4 BEGIN
5 /*
6 || enforce all bids are final rule
7 */
8 --Supply missing code.
18
19 END bids_ARIUD;
20 /

Trigger created.

SQL> INSERT INTO auction_items
2 VALUES ('GB123','Antique gold bracelet',350.00,NULL,'OPEN');

1 row created.

SQL>
SQL> INSERT INTO auction_items
2 VALUES ('PS447','Paul Stankard paperweight',550.00,NULL,'OPEN');

1 row created.

SQL>
SQL> INSERT INTO auction_items
2 VALUES ('SC993','Schimmel print',750.00,NULL,'OPEN');

1 row created.

SQL>
SQL> COMMIT;

FIRST BIDDER.TXT

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 200
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',200);
xyz.auction.place_bid('GB123',200);
*
ERROR at line 2:
ORA-06550: line 2, column 4:
PLS-00201: identifier 'XYZ.AUCTION' must be declared
ORA-06550: line 2, column 4:
PL/SQL: Statement ignored
ORA-06550: line 3, column 4:
PLS-00201: identifier 'XYZ.AUCTION' must be declared
ORA-06550: line 3, column 4:
PL/SQL: Statement ignored


SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 200
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',200);
BEGIN
*
ERROR at line 1:
ORA-20003: PLACE_BID ERR: bid too low
ORA-06512: at "XYZ.AUCTION", line 94
ORA-06512: at line 2


SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 500
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',500);
Item GB123 has new bid: $600.00 placed by: X2

PL/SQL procedure successfully completed.

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 650
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',650);

PL/SQL procedure successfully completed.

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 750
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',750);

PL/SQL procedure successfully completed.

SQL>
SQL>

SECOND BIDDER.TXT

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 600
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',600);
Item GB123 has new bid: $650.00 placed by: X1

PL/SQL procedure successfully completed.

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 625
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',625);
BEGIN
*
ERROR at line 1:
ORA-20003: PLACE_BID ERR: bid too low
ORA-06512: at "XYZ.AUCTION", line 94
ORA-06512: at line 2


SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 700
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',700);

PL/SQL procedure successfully completed.

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 745
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',745);
BEGIN
*
ERROR at line 1:
ORA-20003: PLACE_BID ERR: bid too low
ORA-06512: at "XYZ.AUCTION", line 94
ORA-06512: at line 2


SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 1000
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',1000);
BEGIN
*
ERROR at line 1:
ORA-20004: PLACE_BID ERR: item is closed
ORA-06512: at "XYZ.AUCTION", line 99
ORA-06512: at line 2


SQL>

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please see the below sections as extracted from the above code snippet. This describes the questions from 1 to 3 as requested. You may comment/revert for any queries.

1. create user xyz identified by xyz;

2.
SQL> create user x1 identified by x1 account unlock;
SQL> grant connect,resource to x1;
SQL> create user x2 identified by x2 account unlock;
SQL> grant connect,resource to x2;

3.
two bidding samples are provided here bidding on the same item GB123.
Both the scenarios are verified and OK.
Please note that the errors raised are user handled exceptionsmentioned in the package.

Both the sample run are as follows.

--FIRST SAMPLE RUN
FIRST BIDDER.TXT
SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 200
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',200);
xyz.auction.place_bid('GB123',200);
*
ERROR at line 2:
ORA-06550: line 2, column 4:
PLS-00201: identifier 'XYZ.AUCTION' must be declared
ORA-06550: line 2, column 4:
PL/SQL: Statement ignored
ORA-06550: line 3, column 4:
PLS-00201: identifier 'XYZ.AUCTION' must be declared
ORA-06550: line 3, column 4:
PL/SQL: Statement ignored

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 200
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',200);
BEGIN
*
ERROR at line 1:
ORA-20003: PLACE_BID ERR: bid too low
ORA-06512: at "XYZ.AUCTION", line 94
ORA-06512: at line 2

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 500
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',500);
Item GB123 has new bid: $600.00 placed by: X2
PL/SQL procedure successfully completed.
SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 650
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',650);
PL/SQL procedure successfully completed.
SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 750
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',750);
PL/SQL procedure successfully completed.


--SECOND SAMPLE RUN

SECOND BIDDER.TXT
SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 600
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',600);
Item GB123 has new bid: $650.00 placed by: X1
PL/SQL procedure successfully completed.
SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 625
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',625);
BEGIN
*
ERROR at line 1:
ORA-20003: PLACE_BID ERR: bid too low
ORA-06512: at "XYZ.AUCTION", line 94
ORA-06512: at line 2

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 700
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',700);
PL/SQL procedure successfully completed.
SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 745
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',745);
BEGIN
*
ERROR at line 1:
ORA-20003: PLACE_BID ERR: bid too low
ORA-06512: at "XYZ.AUCTION", line 94
ORA-06512: at line 2

SQL> set serveroutput on size 100000
SQL> set verify on
SQL> BEGIN
2 xyz.auction.place_bid('GB123',&bid);
3 xyz.auction.watch_bidding(15);
4 END;
5 /
Enter value for bid: 1000
old 2: xyz.auction.place_bid('GB123',&bid);
new 2: xyz.auction.place_bid('GB123',1000);
BEGIN
*
ERROR at line 1:
ORA-20004: PLACE_BID ERR: item is closed
ORA-06512: at "XYZ.AUCTION", line 99
ORA-06512: at line 2

Add a comment
Know the answer?
Add Answer to:
PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SQL Triggers: ARE VARELA VSA LINE NTS LINE RPHE DATE DU MEADDE Create a trigger named...

    SQL Triggers: ARE VARELA VSA LINE NTS LINE RPHE DATE DU MEADDE Create a trigger named trg prod QOH_on_line_update that will automatically update the product quantity on hand for a product when a corresponding product LINE row is updated. A template has been created for you below for this trigger. Fill in the ... areas with the proper code: CREATE OR REPLACE TRIGGER trg prod_QOH_on_line_update BEFORE UPDATE ON LINE FOR EACH ROW BEGIN UPDATE SET WHERE END; COMMIT;

  • SQL Triggers: PESOFT P NOTE POO IS DOCE ESTE GIS DAN DISINI OS ARRANCE US PHONE...

    SQL Triggers: PESOFT P NOTE POO IS DOCE ESTE GIS DAN DISINI OS ARRANCE US PHONE QUS BALANCE WOO PARCE P DISCOUNT V OGLE VALE VONTACT VAREATCOS VEMONE V SAE VORCER SED IN DATE P ORDE UNE UNITS UPER BP NE BPNTAL PP 14 DATE VENTA DE BP VOR Create a trigger called named trg_prod QOH_on_line_add that will automatically update the product quantity on hand for a product when a corresponding product LINE row is added. We end a trigger...

  • 1. Create a PL/SQL program block that determines the top students with respect to GPA. Assume...

    1. Create a PL/SQL program block that determines the top students with respect to GPA. Assume that the database has four tables. Student(SSN, SName, DOB, Major) , Grade(SSN, CNo, Grade(0,1,2,3,4)) and Course table(CNo,CName, Credit Hour), Prerequisite(CNo, PreCNo); Student and couse data ae given in the following SQL statements a. Accept a number n as user input with SQL*Plus telling top n%. b. In a loop get the SName and GPA of the top n% people with respect to GPA. c....

  • Oracle 11g PL/SQL Programming Sometimes Brewbean’s customers mistakenly leave an item out of a basket that’s...

    Oracle 11g PL/SQL Programming Sometimes Brewbean’s customers mistakenly leave an item out of a basket that’s already been checked out, so they create a new basket containing the missing items. However, they request that the baskets be combined so that they aren’t charged extra shipping. An application page has been developed that enables employees to change the basket ID of items in the BB_BASKETITEM table to another existing basket’s ID to combine the baskets. A block has been constructed to...

  • 1. This trigger is from Figure 16.2 of the text. Copy and run this trigger so it is created in th...

    1. This trigger is from Figure 16.2 of the text. Copy and run this trigger so it is created in the ap database. You can run the UPDATE below to test it. Notice two things. The error message appears as a pink screen just like a syntax error would. Also, if you then query the invoices table, the UPDATE statement did not execute. The trigger prevented the erroneous UPDATE from changing the data.                 DELIMITER // CREATE TRIGGER invoices_before_update    BEFORE UPDATE...

  • 1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database....

    1. Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE permission to the new role for the Orders and OrderItems table. Give SELECT permission for all user tables. 2. Write a script that (1) creates a login ID named “RobertHalliday” with the password “HelloBob”; (2) sets the default database for the login to the MyGuitarShop database; (3) creates a user named “RobertHalliday” for the login; and (4) assigns the user...

  • PLEASE MAKE SURE TO ANSWER PART 2 AND 3. YOU DON'T HAVE TO WORRY ABOUT PART...

    PLEASE MAKE SURE TO ANSWER PART 2 AND 3. YOU DON'T HAVE TO WORRY ABOUT PART 1, I ALREADY GOT IT PART 1 Part 1: Please read the business statement below and draw ER, NER, and Table Schema diagrams for it. You can submit your diagrams as a Dia file or an image file (GIF, JPG, or PNG). Business Statement: The project is about developing an auction Web site. The details are as follows: BA is an online auction Web...

  • using sql answer the following i need to double check my answers Question 1 Controls the...

    using sql answer the following i need to double check my answers Question 1 Controls the flow of execution based on a condition begin...end try...catch goto if...else 10 points Question 2 Changes the database context to the specified database. set alter exec use 10 points Question 3 Exits the innermost WHILE loop. goto quit return break 10 points Question 4 Controls the flow of execution when an error occurs declare on error goto try...catch continue...error 10 points Question 5 Declares...

  • Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB...

    Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB4DB; USE LAB4DB; CREATE TABLE CUSTOMER ( CUS_CODE int primary key, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT INTO CUSTOMER VALUES('10011','Dunne','Leona','K','713','894-1238','0'); INSERT INTO CUSTOMER VALUES('10012','Smith','Kathy','W','615','894-2285','345.86'); INSERT INTO CUSTOMER VALUES('10013','Olowski','Paul','F','615','894-2180','536.75'); INSERT INTO CUSTOMER VALUES('10014','Orlando','Myron','','615','222-1672','0'); INSERT INTO CUSTOMER VALUES('10015','O''Brian','Amy','B','713','442-3381','0'); INSERT INTO CUSTOMER VALUES('10016','Brown','James','G','615','297-1228','221.19'); INSERT INTO CUSTOMER VALUES('10017','Williams','George','','615','290-2556','768.93'); INSERT INTO CUSTOMER VALUES('10018','Farriss','Anne','G','713','382-7185','216.55'); INSERT INTO CUSTOMER VALUES('10019','Smith','Olette','K','615','297-3809','0'); /*...

  • Create a program that performs the following operations: 1. Prompt for and accept a string of...

    Create a program that performs the following operations: 1. Prompt for and accept a string of up to 80 characters from the user. • The memory buffer for this string is created by: buffer: .space 80 #create space for string input The syscall to place input into the buffer looks like: li $v0,8 # code for syscall read_string la $a0, buffer #tell syscall where the buffer is li $a1, 80 # tell syscall how big the buffer is syscall 2....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT