We help IT Professionals succeed at work.

Cursor in SQL

graziazi
graziazi asked
on
Medium Priority
321 Views
Last Modified: 2012-05-11
Hi. I want to use a cursor on a table of managers. If any manager has a salary less that 10k raise and error. If manager has salary > than 50k output a message and re-raise the exception.


This is what i have so far............


DECLARE CURSOR man_cur IS SELECT * FROM manager WHERE salary < 10000.........

I'm confused after this. Thanks
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
I don't understand the question.  Please provide more of the requirements.

For example: are you wanting a pl/sql procedure with a loop through the cursor?  If you hit a vlue and raise an exception, it stops.  How do you want to 'output' a value before the exception?


Sample data and expected results would help a lot.

Author

Commented:
Yes I want a pl/sql procedure with a loop through the cursor. Ok let's simplify by taking out the 90k clause
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.