RE: LET statement in 4GL
Posted in 2000
another way is to use report (output report in ....) and format your report
not very elegant, but it's work fine
Pierre Delandre
-----Original Message-----
From: Art S. Kagel [mailto:kagel@bloomberg.net]
Sent: Tuesday, May 09, 2000 10:43 AM
To: informix-list@iiug.org
Subject: Re: LET statement in 4GL
DarkEmperor wrote:
>
> I want to prepare an SQL statement from
> the following LET:
> LET selstmt = "UNLOAD TO ", DELETE_DIR CLIPPED, gr_item.isn USING
> "<<<<<<<<<<", "dp", " SELECT * FROM process WHERE process.isn = ",
> gr_item.isn
> The prepare statement is falling over with a SQL -201 synntax error.
> When I DISPLAY the selstmt from the program the output is:
> UNLOAD TO /unloaddir/12345678dp SELECT * FROM process WHERE process.isn => 12345678
> If I cut and paste this into dbaccess it unloads the row correctly.
> Any suggestions?
That's because UNLOAD is a dbaccess built in command and also a 4GL built-in
operator. UNLOAD is NOT an SQL statement that the server recognizes so you
cannot PREPARE it since PREPARE sends the statement to the server to be
optimized and the server does not recognize it. Doing so it akin to
PREPARING a FOREACH statement.
I believe you can PREPARE the SELECT statement then:
UNLOAD TO "filename" sel_stmt_name
Art S. Kagel