Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

case statement

Status
Not open for further replies.

FALCONSEYE

Programmer
Jul 30, 2004
1,158
US
I have the following ( part of my function):

Code:
...
tempSalesPrice      varchar2  := '0';  
tempCode            number    := NULL;  
tempVariance        number    := 0;
...
 select cllc.code, variance_from_commissions, 
    ( case when tempSalesPrice != '0' then tempSalesPrice
           else ru.calc_sale_price 
           end) 
    into tempCod, tempVariance, tempSalesPrice
    from  mytable1 ru
    inner join mytable2 cllc 
    on cllc.pid = ru.pid
    where ... ;


when i compile this, i get

Warning: compiled but with compilation errors

How do i run a case statement and assign the returning value to a variable ?
thanks in advance.



 
I assume you are aware of how to look for details of the error using either "show errors" or select * from user_errors. In future, you should post the output of that rather than the compilation message.
 
Also, unless there is an OVERWELMING reason, store numbers in a number, strings in a varchar2, and dates in a DATE. There is no reason that I can think of to store your sales price in a varchar!

Bill
Lead Application Developer
New York State, USA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top