troubleshooting Question

Call function based on condition in SQL

Avatar of crgary_tx
crgary_txFlag for United States of America asked on
Oracle Database
4 Comments3 Solutions1110 ViewsLast Modified:
Currently I have SQL like below
select col a, b, funct(b) as c
from
tab a,
tab b,
..
..
where..
...
I want to modify the SQL so as to call the funct(b) only if there is a count of a value in col a more than 1.

in the example below. I want col c to take the values of col b except where col b value is more than one in which case it should call a function.

col a   col b    col c
231      abc    abc
135      pew   pew
123      wer    value of function
123      tui      value of function
423      abx    abx
567     sad     sad

thanks,
Gary
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros