Accessing tmp tables in 4gl program
Posted in 1999
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
Is it possible to access the tmp table created in the Stored procedure in the
4gl program ?????
I'm calling a SP in my 4gl program.
The SP creates a temp table and fills some data.
I need to access this table in my 4gl program after calling the SP....
It gives me compilation error saying the tmp table not found in the database
???
Pl. help me out !!!!!!!!
The following is the code ..
DATABASE apstst
MAIN
PREPARE s1 FROM "execute procedure p_crtreftabs ()"
EXECUTE s1
call select_func()
END MAIN
function select_func ()
define r_applacct RECORD LIKE t_tabname_list1.*
declare acct_curs CURSOR FOR
SELECT * FROM t_tabname_list1
FOREACH acct_curs INTO r_applacct.*
DISPLAY r_applacct.*
END FOREACH
end function
TIA,
krishnakumar
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>Is it possible to access the tmp table created in the Stored procedure in the >4gl program ????? > Does anyone read anymore? A temp is only valid for the instance creating it. The instance of the procedure is not the same as that of the caller. So ...
"instance" is the wrong word to use here, since it is has a very specific technical meaning in the Informix world. Please look up "instance" in the index of the Administrator's Guide and read on ... M00n321 wrote: > >Is it possible to access the tmp table created in the Stored procedure in the > >4gl program ????? > > > > Does anyone read anymore? A temp is only valid for the instance creating it. > The instance of the procedure is not the same as that of the caller. So ...
krishnakn@yahoo.com wrote: > > Is it possible to access the tmp table created in the Stored procedure in the > 4gl program ????? > > I'm calling a SP in my 4gl program. > The SP creates a temp table and fills some data. > > I need to access this table in my 4gl program after calling the SP.... > > It gives me compilation error saying the tmp table not found in the database > ??? As Octav Chiriac correctly pointed out, you can use temp tables OK in your I4GL programs, and you can access temp tables created by a stored procedure in the main I4GL code. The problem is that you cannot declare a RECORD LIKE temptable.* or a variable like any of the columns in a temptable. What Octav didn't explain is the reason for this -- which is very simple. The temp table does not exist at compile time, so the I4GL compiler cannot determine from the system catalogue what the structure of the table will be. The tables that you refer to in a LIKE clause must exist at compile time, which absolutely rules out temp tables, and also dynamically created non-temporary tables. Temp tables cannot be shared between database connections (eg between two separate processes, but also not between two separate connections in a single process). Thus, if you need to use a table for inter- process communication, you have to use non-temporary tables. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>