#1271 SQL / PSM: aggregate function do not see variables

current-release
closed-fixed
1
2013-12-30
2012-11-16
No

The problem seems to be similar to 3107413.
Find complete example in attached file, essence is:
CREATE PROCEDURE show_sum_problem()
MODIFIES SQL DATA
BEGIN ATOMIC
test_var: BEGIN ATOMIC
declare v_sum SmallInt;
declare c_const SmallInt;
set c_const = 1;
set v_sum =
-- works NOT
select sum(c_const) -- same for count, avg, etc.
from test t

/* works
select sum(t2.test_id)
from test t
join test t2 on t2.test_id = c_const;
*/
do_update2:begin atomic
declare undo handler for SQLEXCEPTION leave do_update2;
update test
set num_chk_equal = v_sum
where test_id = 1
;
END do_update2;
END test_var;
end;

Error: user lacks privilege or object not found: C_CONST
SQLState: 42501
ErrorCode: -5501

Discussion

  • Fred Toussi

    Fred Toussi - 2012-11-18

    Thanks. Good test case.

    Fixed and committed. Latest snapshot jar is now available with the fix.

     
  • Fred Toussi

    Fred Toussi - 2012-11-18
    • milestone: --> current-release
    • priority: 5 --> 1
    • labels: --> engine 2.0
    • assigned_to: nobody --> fredt
    • status: open --> open-fixed
     
  • Fred Toussi

    Fred Toussi - 2013-12-30
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks