Subject Re: [firebird-support] Problems with cursor
Author Nicolas Serr
"select all values" means removing "and crit1 = '1002'".

If I run this select on the database I get exactly the values I need.

Thanks!

Nicolas

How

Helen Borrie schrieb:

>At 01:06 PM 7/03/2005 +0100, you wrote:
>
>
>
>>Hi,
>>
>>I�?ve got problems using a cursor.
>>
>>Syntax is like:
>>
>>FOR select a.field1, a.field2, b.field3
>>
>>
>>from tab1 a, tab2 b
>
>
>>where a.id = b.id
>>and crit1 = '1002'
>>and ...
>>group by a.field1, a.field2, b.field3
>>into :v_field1, v:field2, :v_field3 DO
>>
>>begin
>>insert into new_tab
>>(field1, field2, field3)
>>values
>>(:v_field1, v:field2, :v_field3);
>>end
>>end
>>
>>As long as crit1 is given there�?s no problem. As soon as I select all
>>values this proc doesn�?t work anymore and nothing is written into new_tab.
>>
>>Any idea??
>>
>>
>
>What do you mean by "all values"? Do you actually mean "all rows", i.e. you
>remove all criteria?
>
>Advice: use the explicit join syntax. It is a lot easier to troubleshoot
>-- and also a bit more likely that you will remember to use fully qualified
>names for EVERYTHING in join sentences:
>
>FOR select a.field1, a.field2, b.field3
> from tab1 a
> join tab2 b
> ON a.id = b.id
>/*
> WHERE a.crit1 = '1002'
> and ...<more qualified criteria>
>*/
>group by a.field1, a.field2, b.field3
>into :v_field1, v:field2, :v_field3 DO
> begin
> insert into new_tab
> (field1, field2, field3)
> values
> (:v_field1, v:field2, :v_field3);
> end
>end
>
>./hb
>
>
>
>
>
>
>
>
>>Thanks in advance!
>>
>>Nicolas
>>
>>
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>


[Non-text portions of this message have been removed]