Search Postgresql Archives

Get count of records from SELECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I have example:

rnum := 0;
FOR r IN EXECUTE ''SELECT *
    FROM ''||table_name||''
    WHERE var = ''||var
LOOP
    IF rnum = 0 THEN
        -- how could I get the count of records here ???
        -- I tried GET DIAGNOSTICS rcount = ROW_COUNT;
        -- BUT it returns ZERO = 0 :(
    END IF;
    rnum := rnum + 1;
END LOOP;

-- here I will get count of records in "rnum", but I need in LOOP's
-- first step

Many thanx from Zet


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux