View Single Post

   
  #3 (permalink)  
Old 04-20-2008, 04:29 PM
scottishpoet
 
Posts: n/a
Default Re: Problem trying insert data into a temp table via SP

On Nov 1, 2:44 pm, an_dario <andro...@gmail.com> wrote:
> Hello!
> I've got a stored procedure which returns data for a report, but for
> generate it, needs to load some data into a temp table. I do this with
> this syntax:
>
> --The temporary table is called 'xreg_kraft'
> system "echo 'load from /tmp/listkraft_tmp.csv insert into
> xreg_kraft;' > /tmp/subir_listkraft.sql";
>
> system "dbaccess maindb /tmp/subir_listkraft.sql";
>
> When the SP tries to run this line, throws an -668 exception (System
> command cannot be executed), with -255 ISAM error (Not in
> transaction). I tried to fix this error handling the exception like
> this:
>
> begin
> on exception in (-668)
> begin work;
> end exception with resume;
> system "dbaccess maindb /tmp/subir_listkraft.sql";
> end
>
> But throws another exception, -535 (Already in transaction), this
> time, with -255 ISAM error (Not in transaction), and makes me confuse,
> because I thought opened the transaction, but I can't see where it is.
>
> Can you give me some clues about this? I appreciate your valuable
> help!
>
> Andres.


dbaccess will have the wrong enviroment when it is run from the stored
procedure

you should write a little script that sets the environment and runs
the dbaccess command

your SYSTEM command should call the script

Reply With Quote