From: renzo_gch@hotmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #8292: Error en Una Función llamada desde NetBeans
Date: Wed, 10 Jul 2013 16:51:25 +0000
Message-ID: <E1Uwxbx-00040J-VQ@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 8292
Logged by: Renzo Carranza
Email address: renzo_gch@hotmail.com
PostgreSQL version: 9.2.3
Operating system: Windows
Description:
Este es mi error "malformed function or procedure escape syntax at offset
6"
Estas son mis funciones con las que hago la transacción en Java NetBeans
CREATE OR REPLACE FUNCTION fu_ingresaralquiler()
RETURNS integer AS
$BODY$
DECLARE
lalquilercodigo integer;
BEGIN
INSERT INTO alquiler(vigencia)
VALUES (true::boolean);
lalquilercodigo = CURRVAL('alquiler_codigo_seq');
return lalquilercodigo;
END;
$BODY$
LANGUAGE 'plpgsql'
CREATE OR REPLACE FUNCTION fu_insertardetallealquiler( pnumero integer,
pnombres character varying, papellidos character varying, pcodigohabitacion
integer)
RETURNS void AS
$BODY$
BEGIN
insert into detallealquiler( numero, nombres, apellidos, codigohabitacion)
values((select codigo from alquiler order by codigo desc limit
1)::integer,pcodigoalquiler::integer, pnumero::integer, pnombres,
papellidos, pcodigohabitacion::integer);
END;
$BODY$
LANGUAGE plpgsql;
Este es mi código en NetBeans para llamar a la función:
public void registrar(TipoHabitacion tipos) throws Exception {
List<Parametro> parsTipo = new ArrayList<Parametro>();
parsTipo.add(new Parametro("", 0));
parsTipo.add(new Parametro("", 0));
parsTipo.add(new Parametro("", 0));
/*parsTipo.add(new Parametro("", tipos.getNombre()));
* parsTipo.add(new Parametro("", tipos.getPrecio()));
* parsTipo.add(new Parametro("", tipos.getCantidad()));*/
try {
this.Conectar(true);
parsTipo.get(0).setValor(
tipos.getNombre());
parsTipo.get(1).setValor(tipos.getPrecio());
parsTipo.get(2).setValor( (int)tipos.getCantidad()) ;
this.EjecutarProcedimiento(
"{call fu_insertartipo(?, ?, ?)}",
parsTipo);
this.Conectar(false);
} catch (Exception e) {
this.Cerrar(false);
JOptionPane.showMessageDialog(null, e);
} finally {
parsTipo.clear();
parsTipo = null;
}
}
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: renzo_gch@hotmail.com
Subject: Re: BUG #8292: Error en Una Función llamada desde NetBeans
In-Reply-To: <E1Uwxbx-00040J-VQ@wrigleys.postgresql.org>
References: <E1Uwxbx-00040J-VQ@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox