Single and Double Quotes and INSERT

You can include a single and double quote in a column value.


CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL,
                  ENAME VARCHAR2(10),
                  JOB VARCHAR2(9),
                  SAL NUMBER(7, 2),
                  DEPTNO NUMBER(2));


SQL> INSERT INTO emp VALUES (9, 'Kyle', 'O''s', NULL, NULL);

1 row created.

SQL>
SQL> select * from emp;

     EMPNO ENAME      JOB              SAL     DEPTNO
---------- ---------- --------- ---------- ----------
         9 Kyle       O's

SQL>

Using Double quotation marks

SQL> INSERT INTO emp VALUES (1, 'TOM','"Great"', NULL, 12);

1 row created.

SQL>
SQL> select * from emp;

     EMPNO ENAME      JOB              SAL     DEPTNO
---------- ---------- --------- ---------- ----------
         9 Kyle       O's
         1 TOM        "Great"                      12

SQL>
Home »
Oracle »
Table » 

Insert:
  1. Adding Rows Using the INSERT Statement
  2. Omitting the Column List
  3. Specifying a Null Value for a Column
  4. Single and Double Quotes and INSERT
  5. Copying Rows from One Table to Another with INSERT
Related: