In a 4gl program I write
UNLOAD TO abc.unl SELECT * FROM tab_chmast
It works fine, but my table name changes dynamically hence I rewrote
LET sql_s = "UNLOAD TO abc.unl SELECT * FROM ",
variable_containing_table_name
PREPARE sql_str FROM sql_s
EXECUTE sql_str
It gives run time error -201 (syntax error)
Any Ideas...
TIA
Sunil
-----------------------<sunil...@tatainfotech.com>-------------------------
. .
. .
. .
. .
. *
. TATA INFOTECH LTD.
. SEEPZ,
. Andheri (E),
SUNIL S. SINGH Mumbai - 400 096,
(Sr. Software Engineer) India.
------------------------------------------------------------------------------
You are not allowed to prepare an unload statement. (RTFM)
But you can do the following:
let tab = "some_table"
let unl_tab = tab clipped, ".unl"
let str = "select * from ", tab, " where cnt_nbr = 'XYZ'"
unload to unl_tab str
--
______________________________________________________________________
| Colin McGrath c...@trac3000.ueci.com |
| Raytheon Engineers & Constructors, Inc. (215) 422-4144 |
| Phila, PA, USA |
| Any opinions I state are my own and not necessarily of my employer |
|____________________________________________________________________|
You can write in 4GL:
LET mystring = "SELECT * FROM tab_chmast"
UNLOAD TO "abc.unl" mystring
--
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.
All opinions are my own and not those of Bayer plc.
My Internet plumbing does not allow me to mail and post news together.
Sorry.
---
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/
HTH
Sathish
> ----------
> From: SUNIL S. SINGH[SMTP:sunil...@tatainfotech.com]
> Sent: Thursday, September 24, 1998 3:23 AM
> To: informix list
> Subject: 4GL/Unload problem ..
>
> H! ....
>
> In a 4gl program I write
>
> UNLOAD TO abc.unl SELECT * FROM tab_chmast
>
> It works fine, but my table name changes dynamically hence I rewrote
>
> LET sql_s = "UNLOAD TO abc.unl SELECT * FROM ",
> variable_containing_table_name
> PREPARE sql_str FROM sql_s
> EXECUTE sql_str
>
> It gives run time error -201 (syntax error)
>
> Any Ideas...
>
> TIA
> Sunil
>
> -----------------------<sunil...@tatainfotech.com>---------------------
Jon
You cannot prepare unload statement in 4GL.
But you can instead use string variable for select clause:
LET vv = "select * from ",var_tab_name
UNLOAD TO abc.unl vv
: TIA
: Sunil
:
--
Dron Alexander, IDS
You cannot prepare an "unload" statement, that's why you have a syntax error
(-201) ...
SUNIL S. SINGH wrote:
> H! ....
>
> In a 4gl program I write
>
> UNLOAD TO abc.unl SELECT * FROM tab_chmast
>
> It works fine, but my table name changes dynamically hence I rewrote
>
> LET sql_s = "UNLOAD TO abc.unl SELECT * FROM ",
> variable_containing_table_name
> PREPARE sql_str FROM sql_s
> EXECUTE sql_str
>
Just to be clear. The reason you cannot prepare an UNLOAD statement is
that it is not a SQL statement it is a 4GL builtin command which was
included to support the same syntax as the UNLOAD built into dbaccess.