Re: 4gl/Windows problem with temporary tables
Posted in 1995
} Subject: 4gl/Windows problem with temporary tables } Date: Mon, 13 Mar 1995 05:07:36 GMT } Reply-To: shague@midland.co.nz (Stewart Hague) } Organization: Home machine } } After having my hand slapped by Kerry Sainsbury for showing bad "Net Manners" } 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: } } | } |e:\\tmp\\play.err - created from e:\\tmp\\play.4gl by FGLC } | } DATABASE editsys } } MAIN } } DEFINE p_tmp_report RECORD } test_id SMALLINT END RECORD } } CREATE TEMP TABLE tmp_report } (test_id SMALLINT) } } SELECT * } INTO p_tmp_report.* } FROM tmp_report } WHERE tmp_report.test_id = 1234 } } UPDATE tmp_report } SET tmp_report.* = (p_tmp_report.*) } | } | The symbol "tmp_report" is not the name of a table in the } | specified database. } | See error number -4320. } | } | 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 MAIN } } } I know this does nothing, but it highlights the problem. } } Any thoughts would be appreciated. } } Thanks } Stu I just got bit when trying to do the same thing. A manually created record was not recognized as being assignment compatible with a row of a database table, even tho' I carefully crafted it to have the same components. I've figured out the reason, and it has to do with some abstruse issues in data type definitions. Suffice it to say that it occurs in other languages, such as Pascal; it's not Informix 4GL's "fault". Anyway, to get around it you have two options. 1. Define the records that you want to be assignment compatible all at the same time: DEFINE var1, var2, var3 RECORD blah, blah, blah END RECORD 2. Define the records that you want to be assignment compatible to be LIKE the same database table: DEFINE var1 RECORD LIKE dbrec.*, var2 RECORD LIKE dbrec.* If possible, combine the two methods: DEFINE var1, var2 RECORD LIKE dbrec.* but that is not always possible, such as when var1 and var2 are in different functions. Regards, Alan +---------------------------+-----------------------------------------------+ | R. Alan Popiel | Internet: alan@den.mmc.com | | Martin Marietta, SLS | Voice: 303-977-9998 | | P.O. Box 179, M/S 3810 | Standard disclaimers apply. Cutesy ones, too. | | Denver, CO 80201-0179 USA | Your mileage may vary. Void where prohibited. | +---------------------------+-----------------------------------------------+