From: Fabiano B. <fa...@pe...> - 2006-04-06 20:09:45
|
Usually, i get a server crash when i run the SP below. It counts the records of all non-systems tables. Sometimes it works, but it crashes very often. Tested with FB 1.5.3 and FB 2.0 RC 1. select * from sp_record_count(null); Here is its code: set term !! ; create or alter procedure sp_record_count ( p_table_name varchar(31) ) returns ( table_name varchar(31), record_count integer ) as begin for select a.rdb$relation_name from rdb$relations a where ( :p_table_name is null or upper(a.rdb$relation_name) = upper(:p_table_name) ) and ( a.rdb$relation_name not like 'RDB$%' ) and ( a.rdb$view_blr is null ) into :table_name do begin execute statement 'select count(*) from "' || :table_name || '"' into :record_count; suspend; end end !! set term ; !! |