Hi, Oh my dear, :) test worked indeed. The issue was in the name clash inside our procedure. During implementation we created real table with the same name as the temporary table that was declared in the procedure. Thanks. Best regards, Radovan On 08/06/2013 10:02 PM, Martin Kersten wrote:
Hi
First, fix your typos :)
create table t1(id bigint); insert into t1 values(23); CREATE PROCEDURE test1() BEGIN DECLARE TABLE t1tmp (b bigint); INSERT INTO t1tmp SELECT id FROM t1; DECLARE v_count BIGINT; -- returns 0 SELECT COUNT(*) INTO v_count FROM t1tmp; END; call test1(); drop procedure test1(); drop table t1;
Remember that a procedure does not return a value for that SQL provides functions
CREATE FUNCTION fcn1() RETURNS bigint BEGIN DECLARE TABLE t1tmp (b bigint); INSERT INTO t1tmp SELECT id FROM t1; DECLARE v_count BIGINT; SET v_count= (select count(*) from t1tmp); RETURN v_count; END; select fcn1(); drop function fcn1(); drop table t1;
regards, Martin On 8/6/13 9:38 PM, Radovan Bičiště wrote:
CREATE PROCEDURE test1() BEGIN DECLARE TABLE t1tmp (bigint); INSERT INTO t1tmp SELECT id FROM t1; DECLARE v_cont BIGINT; -- returns 0 SELECT COUNT(*) INTO v_count FROM t1tmp; END;
users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list
-- __________________________ Radovan Bičiště ceos data s.r.o. třída SNP 402/48 500 03 Hradec Králové Czech Republic mobil CZ: +420 601 563 014 skype: rbiciste