home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / vms / 14157 < prev    next >
Encoding:
Text File  |  1992-08-26  |  2.5 KB  |  65 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!mcsun!dxcern!vxcrna.cern.ch!huber
  3. From: huber@vxcrna.cern.ch (Sepp Huber, CERN -4439,-6712)
  4. Subject: Re: Use of Symbols with SQL
  5. Message-ID: <26AUG199222201282@vxcrna.cern.ch>
  6. News-Software: VAX/VMS VNEWS 1.41    
  7. Sender: news@dxcern.cern.ch (USENET News System)
  8. Organization: European Organization for Nuclear Research, CERN
  9. References: <9208251827.AA15454@univax.fhda.edu>
  10. Date: Wed, 26 Aug 1992 21:20:00 GMT
  11. Lines: 52
  12.  
  13. In article <9208251827.AA15454@univax.fhda.edu>, hasan%avax.dnet@UNIVAX.FHDA.EDU (HASAN%AVAX.DNET@UNIVAX.FHDA.EDU) writes...
  14. >        Is there a way, that I can translate symbols set via
  15. >        DCL, into SQL insert statements?
  16. >        The code shown below, does not work.  SQL is not
  17. >        translating the symbols A, B or C to their values.
  18. >        I am just curious, if there is any other way to use
  19. >        symbol definitions in SQL?
  20. >==========================================================================
  21. >    $    A = "AAAVAX.XXYY"
  22. >    $    B = "999.99.99.99"
  23. >    $    C = "8650"
  24. >    !
  25. >    SQL
  26. >    !
  27. >    DECLARE SCHEMA FILENAME INTERNET_INFO;
  28. >    !
  29. >    INSERT INTO NODE_INFO (NAME, ADDRESS, HWARE)
  30. >                VALUES ("''A'", "''B'", "''C'"); 
  31. >        |
  32. >    COMMIT;
  33. >==========================================================================
  34. There's nothing specific to SQL, it's a general misunderstanding of how
  35. applications interact with DCL (or other CLIs):
  36. Only DCL itself interprets the syntax of "''A'" and other such DCL-language
  37. constructs, not the application (SQL) which simply gets the lines as data on
  38. its standard input/SYS$INPUT.
  39. (Only very clever applications having a built-in interpreter for DCL would be
  40. able to handle the above lines :-).
  41.  
  42. However, a simple change in Your DCL script will do what you want:
  43. $A = "AAAVAX.XXYY"
  44. $B = "999.99.99.99"
  45. $C = "8650"
  46. $ tmpfile = "SYS$SCRATCH:SQLTEMP.COM"
  47. $ if f$search(tmpfile).nes. "" $then delete/noconfirm 'tmpfile';*
  48. $ OPEN/WRITE/ERROR=shoutatme tmp 'tmpfile'
  49. $write tmp "$SQL"
  50. $write tmp "DECLARE SCHEMA FILENAME INTERNET_INFO;"
  51. $write tmp "INSERT INTO NODE_INFO (NAME, ADDRESS, HWARE)"
  52. $write tmp "VALUES (''A', ''B', ''C'); "
  53. $write tmp "COMMIT;"
  54. $write tmp " ... some more SQL up to EXIT ..."
  55. $write tmp "$ EXIT $STATUS !this is exit from sqltemp.com"
  56. $ close tmp
  57. $ @'tmpfile'   !this now executes the SQL statements
  58. $ delete/noconfirm 'tmpfile';* !clean up
  59. ..
  60. -
  61. Joseph "Sepp" Huber        | At present in CERN
  62. Max-Planck-Institut Physik | Internet: huber@vxcern.cern.ch
  63. Munich, Germany            | HEPnet:   VXCERN::HUBER
  64.