Details

      Description

      Oracle does not distinguish between empty strings and NULL.
      MariadDB should do the same when running with sql_mode=ORACLE.

      Example:

      DROP TABLE t1;
      CREATE TABLE t1 (id INT NOT NULL, s VARCHAR(10) NOT NULL);
      INSERT INTO t1 VALUES (1, '');
      

      INSERT INTO t1 VALUES (1, '')
                                *
      ERROR at line 1:
      ORA-01400: cannot insert NULL into ("SYSTEM"."T1"."S")
      

      Example:

      DROP TABLE t1;
      CREATE TABLE t1 (id INT NOT NULL, s VARCHAR(10));
      INSERT INTO t1 VALUES (0, NULL);
      INSERT INTO t1 VALUES (1, '');
      INSERT INTO t1 VALUES (2, 'test');
      SELECT * FROM t1 WHERE s IS NULL;
      

      	ID S
      ---------- ----------
      	 0
      	 1
      

      Example:

      SELECT '' AS c1, NULL AS c2 FROM DUAL;
      

       
      C C
      - -
      
      

      Example:

      DROP TABLE t1;
      CREATE TABLE t1 (v VARCHAR(10), c CHAR(10));
      INSERT INTO t1 VALUES ('','');
      SELECT v,c FROM t1;
      

      V	   C
      ---------- ----------
      
      

      Example:

      DROP TABLE t1;
      CREATE TABLE t1 (v VARCHAR(10));
      INSERT INTO t1 VALUES ('');
      SELECT * FROM t1 WHERE v='';
      

      no rows selected
      

      Example:

      DROP TABLE t1;
      CREATE TABLE t1 (v VARCHAR(10));
      INSERT INTO t1 VALUES ('');
      SELECT * FROM t1 WHERE v IS NULL;
      

      V
      ----------
      
      

      Example:

      DROP TABLE t1;
      CREATE TABLE t1 (c CHAR(10));
      INSERT INTO t1 VALUES ('');
      SELECT * FROM t1 WHERE c='';
      

      no rows selected
      

      Example:

      DROP TABLE t1;
      CREATE TABLE t1 (c CHAR(10));
      INSERT INTO t1 VALUES ('');
      SELECT * FROM t1 WHERE c IS NULL;
      

      C
      ----------
      
      

      Example:

      DROP TABLE t1;
      CREATE TABLE t1 (v VARCHAR(10));
      INSERT INTO t1 VALUES ('');
      SELECT v||'A' FROM t1;
      

      V||'A'
      -----------
      A
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated: