0% found this document useful (0 votes)
25 views1 page

Ice 8 Database

The document contains a PL/SQL code snippet that calculates the average price of events from a database. It then retrieves and displays the names and prices of events that have a price greater than the calculated average. The output is formatted to show the event name followed by its price.

Uploaded by

nkunalotricia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Ice 8 Database

The document contains a PL/SQL code snippet that calculates the average price of events from a database. It then retrieves and displays the names and prices of events that have a price greater than the calculated average. The output is formatted to show the event name followed by its price.

Uploaded by

nkunalotricia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

ICE 8 DATABASE

DECLARE
avg_price DECIMAL(10, 2);
BEGIN
-- Calculate the average price of all events
SELECT AVG(event_price) INTO avg_price FROM events;

-- Display events with a price greater than the average


FOR event_record IN
(SELECT event_name, event_price
FROM events
WHERE event_price > avg_price)
LOOP
DBMS_OUTPUT.PUT_LINE(event_record.event_name || ' - PRICE R' ||
event_record.event_price);
END LOOP;
END;

You might also like