create procedure ttt ( out cnt integer)
DECLARE v_row_count integer ;
DECLARE v_DynSQL varchar(125) ;
DECLARE C1 cursor for v_PrepSQL ;
SET v_DynSQL='SELECT COUNT(*) FROM DBA.GRANT';
PREPARE v_PrepSQL from v_DynSQL;
open c1 ;
fetch c1 into CNT ;
Value of output parameters
Parameter Name : CNT
Parameter Value : 5211
Return Status = 0
Best Regards, Guy Przytula
Database Software Consultant
Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
Information Server Datastage Certified http://www.infocura.be
Thanks for the reply, now I have a similiar issue where i want to include a 'WHERE' clause with parameter marker and fetch the count, Wondering how to prepare a dynamic sql statement with parameter markers and associate a cursor for it and fetch the result into a variable.