String Literal delimiter (Single quotes)

In Oracle the string has to be enclosed in single quotes.

For example
xyz varchar2(10) := 'hello'
where person = 'saran'

If the string has single quotes/apostrophe then you have to specify two single quotes
xyz varchar2(10) := 'I''m happy'
where person = 'saran''s girlfriend'

To define your own delimiter character for the string literal
you specify q'

xyz varchar2(10) := q'#I'am happ#'
where person = q'!saran's girlfriend!'

Comments