Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqqnp-0007eX-MR for pgsql-bugs@arkaria.postgresql.org; Thu, 03 Jan 2013 19:50:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tqqno-0006KJ-Rk for pgsql-bugs@arkaria.postgresql.org; Thu, 03 Jan 2013 19:50:08 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TqpOm-0006xc-PP for pgsql-bugs@postgresql.org; Thu, 03 Jan 2013 18:20:12 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TqpOl-0000C5-Eu for pgsql-bugs@postgresql.org; Thu, 03 Jan 2013 18:20:12 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TqpOl-0003LK-7C for pgsql-bugs@postgresql.org; Thu, 03 Jan 2013 18:20:11 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1TqpOk-0007By-DS for pgsql-bugs@postgresql.org; Thu, 03 Jan 2013 18:20:10 +0000 Date: Thu, 03 Jan 2013 18:20:10 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7784: trouble with pl ERROR: missing FROM-clause entry for table To: pgsql-bugs@postgresql.org From: smatiz@hotmail.com X-Pg-Spam-Score: -1.0 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 7784 Logged by: Santiago Matiz Vasquez Email address: smatiz@hotmail.com PostgreSQL version: 9.2.2 Operating system: MAC LION 10.7.4 Description:=20=20=20=20=20=20=20=20 CREATE OR REPLACE FUNCTION financiero.marchar(pidproducto int,pcant int,pnrocuenta int,pcedula character varying(20)) RETURNS character varying(100) AS $$ DECLARE valores inventarios.productos%ROWTYPE; mesa general.mesa%ROWTYPE; =20 nromesa int; valorTOTAL real; valorIVA integer; salida character varying(100); BEGIN /*=20 Busca dentro de la tabla de numero de cuenta la asociacion con la mesa si no la encuentra pone 0 */ SELECT * INTO mesa FROM general.mesa WHERE nrocuenta =3D pnrocuenta; IF (mesa.nrocuenta IS NULL) THEN nromesa :=3D 0; ELSE nromesa :=3D mesa.nrocuenta; END IF; /* consulta el valor del producto */ SELECT INTO valores * FROM inventarios.productos WHERE idproducto=3Dpidproducto; RAISE NOTICE 'valores.iva (%)', =EF=BB=BFvalores.iva; valorTOTAL :=3D valores.valor * valores.iva * pcant; =20 salida :=3D cast(valores.idproducto as character varying(5))|| '|' || valores.nombre || '|' || CAST(valores.valor AS character varying(10)) || '|' || CAST(pcant AS character varying(10)) ; /*crea el cargo*/ INSERT INTO financiero.cargos(valoru,idmesa,cedula,idproducto,cant,nrocuenta,valor_iva,= iva) VALUES (valorTOTAL,nromesa,pcedula,pidproducto,pcant,pnrocuenta,0,valores.iva); RETURN salida; =20=20=20=20 END; $$ LANGUAGE plpgsql; execute :=20 select financiero.marchar(1,1,1,'1'); result: ERROR: missing FROM-clause entry for table "=EF=BB=BFvalores" LINE 1: SELECT =EF=BB=BFvalores.iva ^ QUERY: SELECT =EF=BB=BFvalores.iva CONTEXT: PL/pgSQL function financiero.marchar(integer,integer,integer,character varying) line 31 at RAISE ********** Error ********** ERROR: missing FROM-clause entry for table "=EF=BB=BFvalores" SQL state: 42P01 Context: PL/pgSQL function financiero.marchar(integer,integer,integer,character varying) line 31 at RAISE table : CREATE TABLE inventarios.productos ( idproducto integer NOT NULL, nombre character varying(200), valor integer, iva real DEFAULT 1.16, CONSTRAINT pk_producto PRIMARY KEY (idproducto) ) WITH ( OIDS=3DFALSE ); ALTER TABLE inventarios.productos OWNER TO dba; --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs