Subject Re: [firebird-support] double single quote
Author Martijn Tonies

> Can someone explain me what is the rule in using single or double
> quotes?
> It seems that double quote works if you use it in a field or table
> name but doesn't work in where clause for values. And the Single
> quote is the opposite.
> I'm just curious if this is done on purpose for SQL compliance or just
> a current limitation.
> I came across this problem when converted some old simple SQLS that
> worked in Oracle (which supports just about everything including
> apples and bananas) and now doesn't work in Firebird.
> It's not really a request, but more for learning purpose and personal
> documentation. I don't want Firebird to be a monster like Oracle, I
> like its simplicity.

Assuming "dialect 3" (the newer dialect which you should
use for any future projects).

When using identifiers, only use double quotes if you want them
to become case sensitive, including non-identifier characters or
using reserved words.

(which is rather stupid of course)

Use single quotes around strings:

WHERE MyCol = 'test'

And escape a single quote inside a string with another single

WHERE MyCol = 'O''Conner' (these are two single quotes)

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Upscene Productions