Forum Stats

  • 3,824,849 Users
  • 2,260,430 Discussions
  • 7,896,330 Comments

Discussions

Introduce Double Quotes In SQL

4005585
4005585 Member Posts: 1
edited May 15, 2020 9:02AM in Database Ideas - Ideas

As someone who started of as an SQL developer and has gradually moved into development using multiple languages it sometimes feels difficult that SQL and PLSQL remain the only languages that remain rigid with the usage of the single quotes. For example SELECT NAME FROM EMPLOYEES WHERE EMPLOYEE_NAME = 'NEW IDEA'. I think keeping in line with new tech Oracle should now be flexible in allowing usage of either both quotes or move to allow double quotes.

14 votes

Active · Last Updated

Comments

  • Sven W.
    Sven W. Member Posts: 10,535 Gold Crown
    edited May 15, 2020 10:01AM

    Just because "other languages are doing it" is very poor reasoning. Explain why you think double quotes would improve your codeing experience.
    Also remember that double quotes are currently used for identifiers like table and column names. Is your suggestion to allow single quotes there instead?

    currently valid syntax:

    select 'abc' "def" from dual;

    your suggestion

    select "abc" 'def' from dual;

    should also be valid.  But why? Where is the advantage? I see potential problems, with syntax errors, that the parser will not recognize as syntax errors anymore.

    example

    select 'a' as "a"          ,'b' as "b"          ,'c'           ,'d'          'e'from dual;

    This would currently result in an error. But your suggestion would allow it, although it is probably a bug.

  • William Robertson
    William Robertson Member Posts: 9,567 Bronze Crown
    edited May 17, 2020 9:48AM

    This would break existing code and remove a useful portability feature, with no clear benefit, so it's a non-starter.

  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,816 Red Diamond
  • Thorsten Kettner
    Thorsten Kettner Member Posts: 42 Red Ribbon

    I don't see any advantage. So far, single quotes are for string literals and double quotes for names. Allowing double quotes for strings, too, would introduce ambiguity and violate the SQL standard.