How to use a cursor...????
Hello everyone i'm new to pl/sql and needed some help on cursors i was hoping someone could give me a layout of what i would need e.g. declare exection and exception which i can then try to have a go with the statements thanks even if someone can give me a start e.g. declare section then i can have a go
A description of the Employees and LEAST_EARNERS tables are shown below.
Name Null ? Type
empno NOT NULL NUMBER(4)
Name Null ? Type
Create a PL/SQL block that determines the bottom n salaries of the
employees within an organisation and inserts them into a table called
LEAST_EARNERS. The block should prompt the user to accept a
number n from the user where n represents the number of earners
from the EMPLOYEES table. You should create a cursor called
emp_cursor that retrieves the salaries of employees in ascending
order. The salaries should not be duplicated. In the executable section,
open the cursor and fetch the least n salaries and insert them into the
LEAST_EARNERS table. Include any appropriate exceptions.
thankyou for the help in advance
Looks like your professor has been talking about cursors for the past few classes, take a look here: http://www.oracle.com/technetwork/is...ql-088608.html
Originally Posted by alankay246
Please note that in the real world you do not have to have a cursor to solve this one.
Last edited by PAVB; 05-04-2012 at 07:25 AM.
Pablo (Paul) Berzukov
Author of Understanding Database Administration
available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
I bet you can get extra credit by writing the query to use analytics.
this space intentionally left blank
Click Here to Expand Forum to Full Width