Einzelnen Beitrag anzeigen

borwin

Registriert seit: 14. Sep 2006
Ort: Rostock
72 Beiträge
 
Delphi 2007 Enterprise
 
#16

AW: Select auf Ergebnis aus gleichem Select

  Alt 18. Feb 2014, 17:19
... so habe ich es gelöst.

Code:
CREATE OR ALTER PROCEDURE PSYS_TAB_RECORDS_COUNT
RETURNS (
    TAB_NAME VARCHAR(31),
    REC_COUNT INTEGER)
AS
BEGIN

  FOR  SELECT TRIM(RDB$RELATION_NAME)
        FROM RDB$RELATIONS
        WHERE (RDB$VIEW_BLR IS NULL)
              AND (RDB$SYSTEM_FLAG = 0)
              AND SUBSTRING(RDB$RELATION_NAME FROM 1 FOR 3)
                    NOT IN ('SYS','IMP','LOG','TEM','DUA')
        ORDER BY RDB$RELATION_NAME
        INTO :TAB_NAME
  DO
  BEGIN
    EXECUTE STATEMENT 'SELECT COUNT(*) FROM ' || TAB_NAME
            INTO :REC_COUNT;

    SUSPEND;
  END
END
und dann so Abfragen
SELECT *
FROM PSYS_TAB_RECORDS_COUNT

Gruß
Borwin
  Mit Zitat antworten Zitat