Created
January 22, 2015 17:40
-
-
Save xtender/7d210be295cfe5bf3c5d to your computer and use it in GitHub Desktop.
PL/SQL: NVL vs Coalesce - 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alter session set plsql_optimize_level=0; | |
| declare | |
| i integer; | |
| a number :=1; | |
| b number :=1; | |
| l integer:=dbms_utility.get_time(); | |
| procedure print(v in varchar2) is | |
| begin | |
| dbms_output.put_line(to_char((dbms_utility.get_time-l)/100,'0999.99')||' '||v); | |
| l:=dbms_utility.get_time(); | |
| end; | |
| begin | |
| print('Start'); | |
| for i in 1..1e7 loop | |
| a:=nvl(b,i); | |
| end loop; | |
| print('NVL'); | |
| for i in 1..1e7 loop | |
| a:=coalesce(b,i); | |
| end loop; | |
| print('Coalesce'); | |
| end; | |
| / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment