bug with variables, link & stored procedures ?

Ivan Smahin ivan_smahin at paradigmasoft.com
Thu Mar 27 08:11:03 CDT 2008


Hello Steven,

Thursday, March 27, 2008, 2:59:12 PM, you wrote:

> I got more problems using this workaround. At first this workaround seems to
> work, but
> upon subsequent calls of this stored procedure, using the declared variables
> with a
> 'select' causes the original value to be used, not the value that it is
> supposed to be :

> Just a part of my stored procedure :
> ---
>         print 'idtestresult = ';
>         print idtestresult;
>         print ' select idtestresult =';
>         print (select idtestresult);
> ---
> When I have run this stored procedure 3 times, I get the following in my
> warnings log file:
> ---
> Print : idtestresult = 
> Print : 1
> Print :  select idtestresult =
> Print : 1
> Print : idtestresult = 
> Print : 2
> Print :  select idtestresult =
> Print : 1
> Print : idtestresult = 
> Print : 3
> Print :  select idtestresult =
> Print : 1
> Print : idtestresult = 
> Print : 4
> Print :  select idtestresult =
> Print : 1
> ---

I will try to reproduce it.

> So the variables themselves contain the correct value, but when called with
> select, they don't
> give the correct result. BUT I have to use it with a select to be able to
> use the link statement,
> because the link statement fails without the select keyword.

> This is a real showtopper for me.

> Any ideas?

Originally it was:


         set idtestresult = SELECT Last_RecID('lpserver') as id;
         set idtestvraag = select id from testVragen where test_id=testId and vraag_id =VraagID;

         link record (idtestresult) of test_resultaten
                 with record idtestvraag of testVragen
                 using link_test_resultaat_vraag;


You can try this instead:

         link record (SELECT Last_RecID('lpserver')) of test_resultaten
                 with record (select id from testVragen where test_id=testId and vraag_id =VraagID) of testVragen
                 using link_test_resultaat_vraag;


-- 
Best regards,
Ivan Smahin 
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list