Reducing the test case to the minimum and compiling on Unix with
version 4.13.UD1 on Solaris 2.4 produces the .err file:
FUNCTION f()
DEFINE
p_tmp_report RECORD
test_id SMALLINT
END RECORD
UPDATE tmp_report
SET tmp_report.* = (p_tmp_report.*)
|
| The number of columns must match the number of values
| in the SET clause of an UPDATE statement.
| See error number -4464.
WHERE tmp_report.test_id = p_tmp_report.test_id
END FUNCTION
The problem is that the Engines do not support the syntax:
UPDATE Table
SET Table.* = (<list of values>)
WHERE <condition>
The 4GL compiler does its best to handle this for you, but it needs to know
the columns in the table at compile time in order to be able to do so.
Since the tmp_report table does not exist, it cannot deduce the column list
from the table, so it reports a compilation error. The fix is to remove
the Table.* notation from the LHS of the SET clause. However, you also
need to provide the parentheses around the list of column names on the LHS,
or you have to list the record elements explicitly, as using the record.*
notation on the RHS means that the compiler needs to know how many columns
are in use on the LHS.
As a general rule, using .* notation in SQL statements is not a very good
idea. It leaves you vulnerable to unexpected changes in the underlying
schemas.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
>From: shague@midland.co.nz (Stewart Hague)
>Subject: 4gl/Windows problem with temporary tables
>Date: Mon, 13 Mar 1995 05:07:36 GMT
>X-Informix-List-Id: <news.12143>
>
>I would like ask if anyone is having problems with temporary tables in
>4GL/Windows.
>
>Software versions are: 4GL/WIN 4.20.WD1, I-NET 5.01 and ONLINE 4.11.UC1.
>
>The following highlights the problem generated by the compiler:
>
> [ larger example, which would execute if it compiled, deleted ]