Informix: SQL does not accept double quote to surround a string

68 Views Asked by At

Is there any configuration that enforce only single quote allowed to surround a string in SQL? Problem occurs after a dbimport.

Database and OS

IBM Informix Dynamic Server Version 14.10.FC8AEE
Red Hat Enterprise Linux release 8.5

Sample SQL: with double quote

$ dbaccess somedb -

Database selected.

> select first 3 tabname[1,30] tabname
from systables
where tabname like "sys%"
;
> > >
  217: Column (sys%) not found in any table in the query (or SLV is undefined).
Error in line 3
Near character position 25
>

Sample SQL: with single quote

$ dbaccess somedb -

Database selected.

> select first 3 tabname[1,30] tabname
from systables
where tabname like 'sys%'
;
> > >

tabname

sysaggregates
sysams
sysattrtypes

3 row(s) retrieved.

>

I found about Informix environment variable DELIMIDENT in the following links: How do I escape reserved words used as identifier in Informix and https://groups.google.com/g/comp.databases.informix/c/zMSiWG3wbLk

I run the following command to check if DELIMENT is set, and nothing shows that the variable has been set

$ env | grep DELIMIDENT
$ set | grep DELIMIDENT
$ onstat -g cfg | grep DELIMIDENT

unset DELIMIDENT doesn't has any effect.

$ unset DELIMIDENT 
$ dbaccess somedb -

Database selected.

> select first 3 tabname[1,30] tabname
from systables
where tabname like "sys%"
;
> > >
  217: Column (sys%) not found in any table in the query (or SLV is undefined).
Error in line 3
Near character position 25
>
1

There are 1 best solutions below

0
Jonathan Leffler On

If you set the environment variable DELIMIDENT=1, then double quotes "…" mark identifiers and only single quotes '…' mark strings. This will usually cause SQL to fail if double quotes are used for ordinary strings.