Re: RE: Totalizar tablas dinamicamente

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: wilhelmtg(at)cantv(dot)net
Cc: pgsql-es-ayuda(at)postgresql(dot)org, hensa22(at)yahoo(dot)es
Subject: Re: RE: Totalizar tablas dinamicamente
Date: 2006-11-18 05:54:35
Message-ID: c2d9e70e0611172154v63fe2e2j61eb5188297ee205@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On 11/17/06, wilhelmtg(at)cantv(dot)net <wilhelmtg(at)cantv(dot)net> wrote:
> Gracias por la respuesta
>
> Estas son las dos formas de obtener el numero de registros....
> ========================================
> SELECT COUNT(*) INTO total FROM cliente;
>
> FOR rec IN SELECT COUNT(*) FROM cliente LOOP
> RETURN rec.count;
> END LOOP;
> RETURN 0;
> ========================================
>
> El detalle o error está cuando envio el nombre de la tabla como
> parametro...

No, lo que te dijeron que debes hacer es:

EXECUTE 'select count(*) from ' || quote_ident($1);

--
Atentamente,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Pedro Mateo 2006-11-18 13:27:44 sobre triggers
Previous Message Jaime Casanova 2006-11-18 05:49:29 Re: Migrar Cobol Postgresql