SAK �}�‘ŠÙ
PostgreSQL •Ò23 - PL/pgSQL�Aƒe�[ƒuƒ‹ƒŒƒR�[ƒhŒ��”ˆê——•\ަ
�¡ƒe�[ƒuƒ‹ƒŒƒR�[ƒhŒ��”ˆê——•\ަ
�EŠeƒe�[ƒuƒ‹‚̃ŒƒR�[ƒhŒ��”‚ð•\ަ‚·‚é‚É‚Í�AŽŸ‚̂悤‚É‚·‚é�B
–ß‚è’l‚ɂ̓e�[ƒuƒ‹�”‚ª•Ô‚é�B
�®�A•¡�”‚̃f�[ƒ^ƒx�[ƒX‚ª‚ ‚é�ê�‡‚Ì“®�ì‚Í–¢ŒŸ�؂ł ‚é�B
-- PL/pgSQL �� --
drop function tblrecct();
create function tblrecct() returns int as
'
declare
rec record;
cu refcursor;
rec2 record;
ct int;
rcd int := 0;
begin
for rec in
select * from pg_tables where not tablename like ''pg%''
order by tableowner, tablename loop
open cu for execute ''select count(*) as ct from '' || rec.tablename;
fetch cu into rec2;
if not found then
ct := 0;
else
ct := rec2.ct;
end if;
close cu;
raise debug ''tablename= % ct= %'', rec.tablename, ct;
rcd := rcd + 1;
end loop;
return rcd;
end;
'
language 'plpgsql'
;
-- PL/pgSQL ŽÀ�s --
select tblrecct();
-- PL/pgSQL Œ‹‰Ê --
DEBUG: tablename= test2m ct= 3
DEBUG: tablename= testm ct= 8
tblrecct
----------
2
�¡PostgreSQL •Ò�AJAVA Servlet�AJSP •ÒŽ‘—¿
�¡MySQL •ÒŽ‘—¿
�¡SQL Šî‘b•ÒŽ‘—¿
�¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
�¡SQL ƒ`ƒ…�[ƒjƒ“ƒO•ÒŽ‘—¿
�¡Oracle PL/SQL •ÒŽ‘—¿