home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vms
- Path: sparky!uunet!mcsun!dxcern!vxcrna.cern.ch!huber
- From: huber@vxcrna.cern.ch (Sepp Huber, CERN -4439,-6712)
- Subject: Re: Use of Symbols with SQL
- Message-ID: <26AUG199222201282@vxcrna.cern.ch>
- News-Software: VAX/VMS VNEWS 1.41
- Sender: news@dxcern.cern.ch (USENET News System)
- Organization: European Organization for Nuclear Research, CERN
- References: <9208251827.AA15454@univax.fhda.edu>
- Date: Wed, 26 Aug 1992 21:20:00 GMT
- Lines: 52
-
- In article <9208251827.AA15454@univax.fhda.edu>, hasan%avax.dnet@UNIVAX.FHDA.EDU (HASAN%AVAX.DNET@UNIVAX.FHDA.EDU) writes...
- >
- > Is there a way, that I can translate symbols set via
- > DCL, into SQL insert statements?
- > The code shown below, does not work. SQL is not
- > translating the symbols A, B or C to their values.
- > I am just curious, if there is any other way to use
- > symbol definitions in SQL?
- >==========================================================================
- > $ A = "AAAVAX.XXYY"
- > $ B = "999.99.99.99"
- > $ C = "8650"
- > !
- > SQL
- > !
- > DECLARE SCHEMA FILENAME INTERNET_INFO;
- > !
- > INSERT INTO NODE_INFO (NAME, ADDRESS, HWARE)
- > VALUES ("''A'", "''B'", "''C'");
- > |
- > COMMIT;
- >==========================================================================
- There's nothing specific to SQL, it's a general misunderstanding of how
- applications interact with DCL (or other CLIs):
- Only DCL itself interprets the syntax of "''A'" and other such DCL-language
- constructs, not the application (SQL) which simply gets the lines as data on
- its standard input/SYS$INPUT.
- (Only very clever applications having a built-in interpreter for DCL would be
- able to handle the above lines :-).
-
- However, a simple change in Your DCL script will do what you want:
- $A = "AAAVAX.XXYY"
- $B = "999.99.99.99"
- $C = "8650"
- $ tmpfile = "SYS$SCRATCH:SQLTEMP.COM"
- $ if f$search(tmpfile).nes. "" $then delete/noconfirm 'tmpfile';*
- $ OPEN/WRITE/ERROR=shoutatme tmp 'tmpfile'
- $write tmp "$SQL"
- $write tmp "DECLARE SCHEMA FILENAME INTERNET_INFO;"
- $write tmp "INSERT INTO NODE_INFO (NAME, ADDRESS, HWARE)"
- $write tmp "VALUES (''A', ''B', ''C'); "
- $write tmp "COMMIT;"
- $write tmp " ... some more SQL up to EXIT ..."
- $write tmp "$ EXIT $STATUS !this is exit from sqltemp.com"
- $ close tmp
- $ @'tmpfile' !this now executes the SQL statements
- $ delete/noconfirm 'tmpfile';* !clean up
- ..
- -
- Joseph "Sepp" Huber | At present in CERN
- Max-Planck-Institut Physik | Internet: huber@vxcern.cern.ch
- Munich, Germany | HEPnet: VXCERN::HUBER
-