Re: LOAD In 4GL Problems
Posted in 2005
Navdeep Virk wrote:
> I tried to load rows into a temp table in a 4GL program ,where I am passing
> the filename as an argument .
> So I used the following syntax.
> DEFINE g_filename CHAR(10)
> .....
> LOAD FROM g_filename INSERT INTO t_sp ,where g_filename is a char variable
> and t_sp is a Temp table.>
> This did not work ,
Why not - what was the error?
> So I tried
>
> LET g_stmt = "LOAD FROM ",g_filename, " INSERT INTO t_sp "
>
> PREPARE p_curs FROM g_stmt
> EXECUTE p_curs
>
> did not work ,
>
> the third approach was
>
> LET g_stmt = "LOAD FROM ? INSERT INTO t_sp "
> PREPARE p_curs FROM g_stmt
> EXECUTE p_curs USING g_filename
>
> This also did not work .
The server has no knowledge of either LOAD or UNLOAD; they are
inherently non-preparable and hence non-executable.
They are simulated in I4GL and ISQL and DB-Access (and SQLCMD and
Aubit4GL and ...).
> I can of course hard code the name of the load file ,also I can try fglgets
> to read in the rows one by one to solve the problem.
>
Use:
LET ins = "INSERT INTO tb_sp"
LOAD FROM g_filename ins
(A tb_sp is a bit bigger than a t_sp - otherwise, there's no difference.)
> But my question is that is there no way the "load into a temp table"
> achieved by passing a file as an argument and using prepare or otherwise
See above.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/