Alternative Quoting Mechanism in Oracle 10g: two quotes really means one quote : Quote « Select Query « Oracle PL / SQL






Alternative Quoting Mechanism in Oracle 10g: two quotes really means one quote

 


SQL> create table TestTable(
  2    ID                    VARCHAR2(4 BYTE)         NOT NULL,
  3    Description           VARCHAR2(30 BYTE)
  4  )
  5  /

Table created.

SQL>
SQL>
SQL> insert into TestTable (ID, Description) values('1','1234 5th Street');

1 row created.

SQL> insert into TestTable (ID, Description) values('2','1 Culloden Street');

1 row created.

SQL> insert into TestTable (ID, Description) values('3','1234 Road');

1 row created.

SQL> insert into TestTable (ID, Description) values('4','33 Thrid Road');

1 row created.

SQL> insert into TestTable (ID, Description) values('5','One than another');

1 row created.

SQL> insert into TestTable (ID, Description) values('6','2003 Movie');

1 row created.

SQL> insert into TestTable (ID, Description) values('7','Start With Letters');

1 row created.

SQL>
SQL> select * from TestTable;

ID   DESCRIPTION
---- ------------------------------
1    1234 5th Street
2    1 Culloden Street
3    1234 Road
4    33 Thrid Road
5    One than another
6    2003 Movie
7    Start With Letters

7 rows selected.

SQL>
SQL> -- Alternative Quoting Mechanism in Oracle 10g
SQL>
SQL> -- two quotes really means one quote
SQL>
SQL> INSERT INTO testTable VALUES (99,'32 O''Neal Drive');

1 row created.

SQL>
SQL> select * from testTable;

ID   DESCRIPTION
---- ------------------------------
1    1234 5th Street
2    1 Culloden Street
3    1234 Road
4    33 Thrid Road
5    One than another
6    2003 Movie
7    Start With Letters
99   32 O'Neal Drive

8 rows selected.

SQL>
SQL>
SQL>
SQL> drop table TestTable;

Table dropped.

SQL>
SQL>
SQL>
           
         
  








Related examples in the same category

1.q'{32 O'Hara Avenue}'): Use a 'q' as the leading character after the parentheses
2.Quoted Identifiers
3.Quoting syntax is q'[ ... ]' where the [] is the user-defined
4.Using two single-quotes print the string correctly