Monday, December 07, 2015

Use of CHR(0) String

Chr(0) is one of the ascii characters Where as NULL is undefined or unknown value.

SELECT ascii(chr(0))  Value FROM DUAL;

Value
-------------
0



Chr(0) is different from NULL.

SELECT DECODE(CHR(0), NULL, 'NULL', 'NOT NULL') Value from dual;

Value
--------
NOT NULL




SELECT length(chr(0)) FROM dual;

LENGTH(CHR(0))
--------------
1

SELECT length(NULL) FROM dual;

LENGTH(NULL)


You can use chr(0) to diplay a blank line with DBMS_OUTPUT.PUT_LINE.

Example

SQL> begin
dbms_output.put_line('This is first line');
dbms_output.put_line( Chr(0));
dbms_output.put_line('This is second line');
end;
/
This is first line

This is second line

PL/SQL procedure successfully completed.

No comments:

Post a Comment

Clear BNE Cache for WebADI Changes

It Sometime happens that WebAdi Changes doesn't reflect once migrated in controlled instances. Here are the quick steps(Generally perfor...