Home » SQL & PL/SQL » SQL & PL/SQL » Re: Return boolean checking condition in multiple records
Re: Return boolean checking condition in multiple records [message #37812] Thu, 28 February 2002 14:37
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
I feel like I'm understanding your question, but I'm not understanding why you don't feel that adding a 'return false' outside your loop satisfies your requirement.

Given the data you supplied above, there will be three rows returned by the cursor. As soon as we evaluate the first row, we see that dept = 'A' and we exit the function. The remaining two rows in the cursor are never evaluated.

If the first row was 'X' instead of A, we would eval it and move on to row 2 because it was not A, B, or C. Row 2 evaluates to true (and the function returns) because the dept = 'B'.

For example, if the three rows for employee 123 had dept values of 'X', 'Y', and 'Z' - we would look at each of the three cursor rows, none would generate a 'return true' and we would exit the loop and then hit the 'return false'.

Isn't this how you want it to work?
Previous Topic: how to retrieve distinct records
Next Topic: Compare 2 tables
Goto Forum:
  


Current Time: Thu Apr 25 11:36:17 CDT 2024