CREATE TABLE customers (
c_id NUMBER(10),
c_name VARCHAR2(50),
c_addr VARCHAR2(50)
);
INSERT INTO customers (c_id, c_name, c_addr) VALUES (1, 'Alice Johnson', '456 Elm St');
INSERT INTO customers (c_id, c_name, c_addr) VALUES (2, 'Bob Smith', '789 Oak St');
INSERT INTO customers (c_id, c_name, c_addr) VALUES (3, 'Charlie Brown', '321 Maple Ave');
INSERT INTO customers (c_id, c_name, c_addr) VALUES (4, 'Diana Prince', '654 Pine Rd');
INSERT INTO customers (c_id, c_name, c_addr) VALUES (5, 'Ethan Hunt', '987 Cedar Blvd');
INSERT INTO customers (c_id, c_name, c_addr) VALUES (6, 'Fiona Davis', '159 Spruce Dr');
INSERT INTO customers (c_id, c_name, c_addr) VALUES (7, 'George Miller', '753 Birch Ln');
INSERT INTO customers (c_id, c_name, c_addr) VALUES (8, 'John Doe', '123 Main St');
COMMIT;
DECLARE
id customers.c_id%TYPE := 7;
name customers.c_name%TYPE;
addr customers.c_addr%TYPE;
BEGIN
-- Fetching the customer's name and address based on the given ID
SELECT c_name, c_addr
INTO name, addr
FROM customers
WHERE customers.c_id = id;
-- Displaying the fetched data
DBMS_OUTPUT.PUT_LINE('Name: ' || name);
DBMS_OUTPUT.PUT_LINE('Address: ' || addr);
EXCEPTION
WHEN no_data_found THEN
DBMS_OUTPUT.PUT_LINE('No such customer!');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('An unexpected error occurred.');
END;
To embed this project on your website, copy the following code and paste it into your website's HTML: