4GL variable substitution in SQL statements - a feature request
Posted in 1998
Having been bitten by this one several times recently I thought I would ask if anyone else finds it a problem. 4GL will, without warning, recognise variable names in scope at the time it compiles a SQL statement. It then links them to the SQL. Often, this is what you want but sometimes not, hence the addition of the @ prefix to variable names which you would like to remain unlinked. I almost always prefix column names in SELECT stements with a table alias, which almost always prevents the problem. The almost refers to DELETE and UPDATE statements where the use of an alias table qualifer to the column is often not required or usual. I would prefer if 4GL had a switch to make it work the SQL standard way, which is to require a : prefix to linked variables. Why: That way the programmer is under total and clear control of what is going on. The current system makes it tricky to use variable names that are the same as column names unless the column names are qualified with a table name or given the @ prefix. The current behaviour can result in a change to a SQL statement as a result of adding a DEFINE of a variable name that happens to occur in the SQL statement. The reader of the program can also see what is happening without needing to discover what variable names are in scope at the SQL statement. Is there any support for this or am I just whingeing into the wind? -- Peter Lancashire Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 --- If all else fails, read the instructions and the release notes. Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/ ---