Re: Function para borrar

From: Micky Khan <mcanchas(at)hotmail(dot)com>
To: Anthony Sotolongo <asotolongo(at)gmail(dot)com>, FORO POSTGRES <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Function para borrar
Date: 2018-05-22 20:36:16
Message-ID: AM4P190MB022584B3B732F5A9F3992D84D7940@AM4P190MB0225.EURP190.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Siempre hay oportunidad de aprender cosas nuevas.

Gracias ese era el asunto...

MK

________________________________
De: Anthony Sotolongo <asotolongo(at)gmail(dot)com>
Enviado: martes, 22 de mayo de 2018 20:32
Para: Micky Khan; FORO POSTGRES
Asunto: Re: Function para borrar

te lo esta diciendo el error: Quítale el rows 1000 del final del código

;-)

saludos

El 22/05/18 a las 16:30, Micky Khan escribió:

Ya lo habia echo asi. Me arroja el siguiente error :

ERROR: ROWS no es aplicable cuando una función no retorna un conjunto

________________________________
De: Anthony Sotolongo <asotolongo(at)gmail(dot)com><mailto:asotolongo(at)gmail(dot)com>
Enviado: martes, 22 de mayo de 2018 20:26
Para: Micky Khan; FORO POSTGRES
Asunto: Re: Function para borrar

Hola Micky, te está diciendo que tienes un error de sintaxis, y a simple vista se ve que la función no esta retornando nada, requisito en PG

te faltaria poner: returns void as , ya que según veo la lógica dentro no te interesa devolver nada, te quedaría mas o menos así:

CREATE OR REPLACE FUNCTION public.borrar_rollos (

seq_rollo integer
)

returns void as
$body$
DECLARE
begin

DELETE FROM almacen WHERE seq_tejido_ejec_detalle = $1 ;

RETURN;

end;
$body$
LANGUAGE 'plpgsql';

saludos

El 22/05/18 a las 16:08, Micky Khan escribió:
Buenas .

Estoy creando una funcion para borrar y me sale este error :

ERROR: error de sintaxis en o cerca de «$body$
DECLARE
begin

DELETE FROM almacen_crudo WHERE seq_tejido_ejec_detalle = $1 ;

RETURN;

end;
$body$»
LINE 1: ...E FUNCTION public.borrar_rollos ( seq_rollo integer ) $body$

Ya intente varias cosas y en la red no encuentro algun ejemplo.

Gracias por su ayuda...

CREATE OR REPLACE FUNCTION public.borrar_rollos (

seq_rollo integer
)

$body$
DECLARE
begin

DELETE FROM almacen WHERE seq_tejido_ejec_detalle = $1 ;

RETURN;

end;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100 ROWS 1000;

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Lazaro Garcia 2018-05-28 13:23:39 Descargar versión 11 beta de postgresql
Previous Message Anthony Sotolongo 2018-05-22 20:32:58 Re: Function para borrar