Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SET SERVEROUTPUT ON;
- DECLARE
- x int;
- CURSOR cust_cursor IS
- SELECT c.LASTNAME, c.FIRSTNAME, c.EMAIL, cs.SKILLLEVEL
- FROM ALLPOWDER.CUSTOMER c
- JOIN ALLPOWDER.CUSTOMERSKILL cs
- ON c.CUSTOMERID = cs.CUSTOMERID
- WHERE cs.SKILLLEVEL > 5
- AND cs.STYLE = 'Freestyle'
- ORDER BY cs.SKILLLEVEL, c.LASTNAME, c.FIRSTNAME;
- cust_rec cust_cursor%ROWTYPE;
- BEGIN
- OPEN cust_cursor;
- LOOP
- FETCH cust_cursor INTO cust_rec;
- EXIT WHEN cust_cursor%NOTFOUND;
- DBMS_OUTPUT.PUT_LINE('Name: ' || cust_rec.lastname || ', ' || cust_rec.firstname);
- DBMS_OUTPUT.PUT_LINE('Email: ' || cust_rec.email);
- DBMS_OUTPUT.PUT('Half-Pipe Rating: ');
- x := 0;
- LOOP
- DBMS_OUTPUT.PUT('*');
- x := x + 1;
- EXIT WHEN x = cust_rec.skilllevel;
- END LOOP;
- DBMS_OUTPUT.PUT_LINE('');
- DBMS_OUTPUT.PUT_LINE('');
- END LOOP;
- CLOSE cust_cursor;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement