Why does Oracle 9i treat an empty string as NULL?

后端 未结 10 1518
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 23:39

I know that it does consider \' \' as NULL, but that doesn\'t do much to tell me why this is the case. As I understand the SQL specifications

10条回答
  •  不要未来只要你来
    2020-11-22 00:00

    Example from book

       set serveroutput on;   
        DECLARE
        empty_varchar2 VARCHAR2(10) := '';
        empty_char CHAR(10) := '';
        BEGIN
        IF empty_varchar2 IS NULL THEN
        DBMS_OUTPUT.PUT_LINE('empty_varchar2 is NULL');
        END IF;
    
    
        IF '' IS NULL THEN
        DBMS_OUTPUT.PUT_LINE(''''' is NULL');
        END IF;
    
        IF empty_char IS NULL THEN
        DBMS_OUTPUT.PUT_LINE('empty_char is NULL');
        ELSIF empty_char IS NOT NULL THEN
        DBMS_OUTPUT.PUT_LINE('empty_char is NOT NULL');
        END IF;
    
        END;
    

提交回复
热议问题