home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.ingres
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!rtech!ingres!mikes
- From: mikes@Ingres.COM (Mike Schilling)
- Subject: Re: problem with "DESC" as column name in Windows4GL
- Message-ID: <1993Jan8.174834.26387@pony.Ingres.COM>
- References: <FRANKS.93Jan8155235@ntrc27.ntrc.ntu.ac.sg>
- Distribution: comp
- Date: 8 Jan 93 17:48:34 GMT
- Lines: 79
-
- From article <FRANKS.93Jan8155235@ntrc27.ntrc.ntu.ac.sg>, by franks@ntrc27.ntrc.ntu.ac.sg (Frank Siebenlist):
- >
- > If a column name of "DESC" is used,
- > then it seems "difficult" to access that column within Windows4GL.
- >
- > For example a script containing:
- >
- > select :my_field = desc
- > from my_table;
- >
- > yields compilation errors like:
- >
- > E_W40118 The symbol 'desc' is undefined.
- >
- > E_PW0005 Can't create variable for desc.
- > A variable couldn't be declared for the ENTRYFIELD desc. A subsequent
- > error should give more information about why it couldn't be created.
- >
- > E_SY0010 Reserved word used as name.
- > A variable (or other kind of object) was given the name `desc' which is
- > a reserved word. You can not use a reserved word to name an object.
- >
- > This is too bad, but it becomes worse if:
- >
- > :my_field = my_table.desc
- >
- > yields the same error.
- >
- > As far as I know, DESC is not a reserved word for column names.
- > Also, other ingres programs like isql have no problem with:
- > select desc from my_table;
- >
- > Is Windows4GL too restrictive? Is this a feature or bug?
- >
- > Is there a workaround?
- >
- > Please don't tell me to rename my column names!
- > (They are predefined by other existing applications.)
- >
- > Regards, Frank.
- >
- > --
- > ---------------------------------------------------
- > Frank Siebenlist <franks@ntu.ac.sg>
- > Senior Research Fellow
- > GINTIC Institute of Manufacturing Technology (GIMT)
- > Nanyang Technological University (NTU)
- > Nanyang Avenue
- > Singapore 2263
- > Tel: (65) 799-1356 Fax: (65) 791-2927
- > ---------------------------------------------------
-
- 'desc' is an SQL keyword; in the ORDER BY clause on a SELECT, you
- can order by ascending (ASC) or descending (DESC). The Windows4GL compiler
- is unhappy about a field whose name is an SQL keyword.
-
- Actually, the example code you show gives me a different error:
-
- select :my_field = desc from a;
- ^
- %% Error at line 8
- E_W400F0 Syntax error. The last symbol read was 'desc'.
-
-
- It's if you call the field 'desc' that you get:
- E_W40118 The symbol 'desc' is undefined.
- etc.
-
- Solution:
- 1. call the field something other than desc (you control the field name).
- 2. Write the select as:
-
- select :my_field = 'desc' from a;
-
- Mike
- ----------------------------------------------------------------------------
- mikes@ingres.com = Mike Schilling, INGRES, An ASK Group Company, Alameda, CA
- Just machines that make big decisions,
- Programmed by fellows with compassion and vision. -- Donald Fagen, "IGY"
-