공부한것들을 정리하는 블로그 입니다.
dbms_output.put_line 줄바꿈 - stackoverflow 본문
반응형
Question.
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 function overloading,even for that close and open brackets are required after function name.
Answer.
Well the difference is that the first formulation fails and the second one 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 /
[ result ]
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('');
*
[ result ]
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>
edit
What does work is the 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 /
[ result ]
some text
about to new_line with a parameter
PL/SQL procedure successfully completed.
SQL>
I don't know when Oracle actually started supprting this convention but I only became aware of it when they introduced the OO stuff. Some member functions (i.e. methods) on Types won't work unless we include the empty brackets e.g. XMLType's getClobVal()
. But the brackets are strictly optional for the standard procedural calls.
반응형
'DB 공부' 카테고리의 다른 글
Oracle : 다건 insert (0) | 2019.07.10 |
---|---|
Oracle : 계층형 쿼리 (0) | 2019.06.28 |
오라클 컬럼명으로 테이블 찾기 (0) | 2019.06.25 |
SQL컬럼으로 sql삽입 (0) | 2019.06.11 |
sqlplus는 접속되는데 DBMS에서는 접속불가인 경우 (0) | 2019.06.11 |
변환함수 TO_CHAR, TO_NUMBER,TO_DATE (0) | 2017.07.30 |
NVL 사용법 (0) | 2017.07.30 |
0. (0) | 2017.07.13 |
Comments