oracle - better way to assign variable percentage change calculated -



oracle - better way to assign variable percentage change calculated -

i have 2 variables in pl/sql procedure counts. using values calculating percentage alter between 2 tables. how doing it:

select ( decode(original_count, 0, to_number(0), ((todays_count - original_count)/original_count) ) ) percentage_change dual;

i wondering if there way using := assignment like:

percentage_change := (decode(original_count, 0, to_number(0), ((todays_count - original_count)/original_count) ) )

can this?

you can utilize case construct:

percentage_change := case when original_count=0 0 else (todays_count - original_count)/original_count end;

oracle plsql

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -