Difference between DBMS_OUTPUT.NEW_LINE and DBMS_OUTPUT.NEW_LINE ()?

What is the difference between these two statements?

dbms_output.new_line(); // with no parameters. dbms_output.new_line; // with no parameters,no round brackets 

If there is an overload of the function, even in order to close and open the brackets it is necessary after the function name.

+4
source share
1 answer

Well, the difference is that the first formulation fails, and the second succeeds:

 SQL> begin 2 dbms_output.put_line('some text'); 3 dbms_output.put('about to new_line with no parameters'); 4 dbms_output.new_line; 5 end; 6 / some text about to new_line with no parameters PL/SQL procedure successfully completed. SQL> begin 2 dbms_output.put_line('some text'); 3 dbms_output.put('about to new_line with a parameter'); 4 dbms_output.new_line(''); 5 end; 6 / dbms_output.new_line(''); * ERROR at line 4: ORA-06550: line 4, column 5: PLS-00306: wrong number or types of arguments in call to 'NEW_LINE' ORA-06550: line 4, column 5: PL/SQL: Statement ignored SQL> 

change

What makes empty brackets ...

 SQL> begin 2 dbms_output.put_line('some text'); 3 dbms_output.put('about to new_line with a parameter'); 4 dbms_output.new_line(); 5 end; 6 / some text about to new_line with a parameter PL/SQL procedure successfully completed. SQL> 

I don’t know when Oracle actually launched this convention, but I only found out when they submitted OO stuff. Some member functions (i.e. Methods) for types will not work unless we include empty brackets, for example. XMLType getClobVal() . But parentheses are strictly optional for standard procedural calls.

+3
source

Source: https://habr.com/ru/post/1306265/


All Articles