NULL generating "Sintax Error"
Posted in 2003
Topics: General Discussion
Hello All. The query bellow generates a sintax error: SELECT 'ADP' , '!' , null , '6.1.1.06' #^ # 201: A syntax error has occurred. # , '!' , '!' , '!' , '!' , GF_CTOP_CTB.CD_CTOP_CTB FROM GF_CTOP_CTB If I replace the word "null" with "''" the statement runs without error. Is there any configuration parameter I could manipulate that would allow me to use "null" as a constant in my queries? Thanks in advance. Jorge Vergara
If you want to return an null value constant in a select statement then your engine must support casting. Assuming your engine allows casting you can use the following if you want a null of type integer. SELECT null::integer FROM table; The database can't return a null without knowing what data type to use for the null value. If your engine does not support casting then you could simulate by creating a table with different columns for the different data types you would need null values for. You could insert one row with null values and join to this table in your queries where you need a null value returned. Gregg Walker "Jorge Vergara" <jlvergara@sispro.com.br> wrote in message news:2f175445.0306200556.4ebda7f8@posting.google.com... > Hello All. > > The query bellow generates a sintax error: > SELECT 'ADP' > , '!' > , null > , '6.1.1.06' > #^ > # 201: A syntax error has occurred. > # > , '!' > , '!' > , '!' > , '!' > , GF_CTOP_CTB.CD_CTOP_CTB > > FROM GF_CTOP_CTB > > If I replace the word "null" with "''" the statement runs without > error. > Is there any configuration parameter I could manipulate that would > allow me to use "null" as a constant in my queries? > > Thanks in advance. > > Jorge Vergara