oracle sqldeveloper - performance testing in sql using with clause -


i have 2 sql shown below

option 1:     select sum(amount)/case when sum(amount) = 0 100 else sum(amount) table_01;   option 2: sample_01 ( select sum(amount) amount table_01 )  select amount/case when amount =0 100 else amount sample_01; 

which option practice in terms of performance perspective , why best ?. felt option 2 best because doing sum once , call again , again instead of doing sum again , again in option 2 . help.


Comments

Popular posts from this blog

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -