home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / ingres / 2197 < prev    next >
Encoding:
Text File  |  1993-01-08  |  2.9 KB  |  90 lines

  1. Newsgroups: comp.databases.ingres
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!rtech!ingres!mikes
  3. From: mikes@Ingres.COM (Mike Schilling)
  4. Subject: Re: problem with "DESC" as column name in Windows4GL
  5. Message-ID: <1993Jan8.174834.26387@pony.Ingres.COM>
  6. References: <FRANKS.93Jan8155235@ntrc27.ntrc.ntu.ac.sg>
  7. Distribution: comp
  8. Date: 8 Jan 93 17:48:34 GMT
  9. Lines: 79
  10.  
  11. From article <FRANKS.93Jan8155235@ntrc27.ntrc.ntu.ac.sg>, by franks@ntrc27.ntrc.ntu.ac.sg (Frank Siebenlist):
  12. > If a column name of "DESC" is used,
  13. > then it seems "difficult" to access that column within Windows4GL.
  14. > For example a script containing:
  15. >     select :my_field = desc
  16. >     from my_table;
  17. > yields compilation errors like:
  18. > E_W40118 The symbol 'desc' is undefined.
  19. > E_PW0005 Can't create variable for desc.
  20. >     A variable couldn't be declared for the ENTRYFIELD desc.  A subsequent
  21. >     error should give more information about why it couldn't be created.
  22. > E_SY0010 Reserved word used as name.
  23. >     A variable (or other kind of object) was given the name `desc' which is
  24. >     a reserved word.  You can not use a reserved word to name an object.
  25. > This is too bad, but it becomes worse if:
  26. >         :my_field = my_table.desc
  27. > yields the same error.
  28. > As far as I know, DESC is not a reserved word for column names.
  29. > Also, other ingres programs like isql have no problem with: 
  30. >     select desc from my_table;
  31. > Is Windows4GL too restrictive? Is this a feature or bug?
  32. > Is there a workaround?
  33. > Please don't tell me to rename my column names!
  34. > (They are predefined by other existing applications.)
  35. > Regards, Frank.
  36. > --
  37. > ---------------------------------------------------
  38. > Frank Siebenlist                 <franks@ntu.ac.sg>
  39. > Senior Research Fellow
  40. > GINTIC Institute of Manufacturing Technology (GIMT)
  41. > Nanyang Technological University (NTU)
  42. > Nanyang Avenue
  43. > Singapore 2263
  44. > Tel: (65) 799-1356               Fax: (65) 791-2927
  45. > ---------------------------------------------------
  46.  
  47. 'desc' is an SQL keyword; in the ORDER BY clause on a SELECT, you
  48. can order by ascending (ASC) or descending (DESC). The Windows4GL compiler
  49. is unhappy about a field whose name is an SQL keyword.
  50.  
  51. Actually, the example code you show gives me a different error:
  52.  
  53.     select :my_field = desc from a;
  54.                 ^
  55.     %% Error at line 8
  56.     E_W400F0 Syntax error.  The last symbol read was 'desc'.
  57.  
  58.  
  59. It's if you call the field 'desc' that you get:
  60.     E_W40118 The symbol 'desc' is undefined.
  61.     etc.
  62.  
  63. Solution:
  64. 1. call the field something other than desc (you control the field name).
  65. 2. Write the select as:
  66.  
  67.     select :my_field = 'desc' from a;
  68.  
  69. Mike    
  70. ----------------------------------------------------------------------------
  71. mikes@ingres.com = Mike Schilling, INGRES, An ASK Group Company, Alameda, CA
  72. Just machines that make big decisions,
  73. Programmed by fellows with compassion and vision.    -- Donald Fagen, "IGY"
  74.