Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: pl/pgsql para torpes


  • From: "Javier Chávez B." <jchavezb(at)gmail(dot)com>
  • To: "Juan Carlos Barranco de Paz" <jcb(at)greccosoft(dot)es>
  • Cc: pgsql-es-ayuda(at)postgresql(dot)org
  • Subject: Re: pl/pgsql para torpes
  • Date: Fri, 30 May 2008 16:54:43 +0100
  • Message-id: <ded64bba0805300854q525963fbwe8e8958802f774f0(at)mail(dot)gmail(dot)com>

On Fri, May 30, 2008 at 12:09 PM, Juan Carlos Barranco de Paz
<jcb(at)greccosoft(dot)es> wrote:
>
>  Hola, estoy empezando a trabajar con pl/pgsql y no entiendo bien el uso de
> las comillas y del raise, por favor me podeis decir como hacer esto o que
> estoy haciendo mal y un donde puedo conseguir un manual paras torpes de
> pl/pgsql.
>
> Cuando ejecuto select dw0_0010() me devuelve este error :
> ERROR:  too many parameters specified for RAISE
> CONTEXT:  PL/pgSQL function "dw0_0010_1" line 6 at raise sentencia SQL:
> «SELECT  dw0_0010_1( $1 )» PL/pgSQL function "dw0_0010" line 13 at perform
>
> ********** Error **********
>
> ERROR: too many parameters specified for RAISE Estado SQL:42601
> Contexto:PL/pgSQL function "dw0_0010_1" line 6 at raise sentencia SQL:
> «SELECT  dw0_0010_1( $1 )» PL/pgSQL function "dw0_0010" line 13 at perform
>
>
> Estas son  las funciónes :
>
>  CREATE OR REPLACE FUNCTION dw0_0010()
>  RETURNS smallint AS
> $BODY$
> DECLARE
>        dw01            dw01conf%ROWTYPE;
>        dw0_0010_c      cursor for select * from dw01conf;
> BEGIN
>        OPEN dw0_0010_c ;
>        LOOP
>                FETCH dw0_0010_c INTO dw01;
>                EXIT WHEN NOT FOUND;
>                PERFORM dw0_0010_1(dw01);
>        END LOOP;
>        CLOSE dw0_0010_c;
>        RETURN 0;
> END;
> $BODY$
>  LANGUAGE 'plpgsql' VOLATILE;
>
> ------ Hasta aqui creo que va bien pero esta me falla por todos lados
>
> CREATE OR REPLACE FUNCTION dw0_0010_1(dw01 dw01conf)
>  RETURNS smallint AS
> $BODY$
> DECLARE
> aux0    text;
> dw10    dw10tcom%ROWTYPE;
> dw0_0010_1_c  refcursor;
> BEGIN
>        RAISE NOTICE 'texto1', dw01.empresa;
>
>        if dw01.origen = 1 or dw01.origen = 3
>        then
>                aux0 := 'select distinct
> c.empresa,to_number(to_char(c.fecha,''YYYYMMDDHH24''),''9999999999''),
>                        to_number(to_char(c.fecha,''YYYY''),''9999''),
>                        to_number(to_char(c.fecha,''Q''),''9''),
>                        to_number(to_char(c.fecha,''MM''),''99''),
>                        to_number(to_char(c.fecha,''W''),''9''),
>                        to_number(to_char(c.fecha,''WW''),''99''),
>                        to_number(to_char(c.fecha,''ID''),''9''),
>                        to_number(to_char(c.fecha,''DD''),''99'')
>                        from    gc05albc c,gc06albl l
>                        where   c.empresa       = ''' || dw01.empresa || '''
>                        and     c.serie         = l.serie
>                        and     c.albaran       = l.albaran
>                        and     c.fecha         >=''' || dw01.fecha_inicial
> || '''
>                        and     c.proveedor     = l.proveedor
>                        and     l.tipo          = 1
>                        and     l.unidades      <> 0
>                        and   length(l.articulo) = 0';
>        end if;
>
>        OPEN dw0_0010_1_c FOR EXECUTE aux0;
>
>        RAISE NOTICE 'PASA';
>        LOOP
>                FETCH dw0_0010_1_c INTO dw10;
>                EXIT WHEN NOT FOUND;
>                RAISE NOTICE 'prueba', dw10.tiempo;
>        END LOOP;
>
>        RAISE NOTICE 'PASA FIN';
>
>        RETURN 0;
> END;
> $BODY$
>  LANGUAGE 'plpgsql' VOLATILE
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 3146 (20080530) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
> --
> TIP 1: para suscribirte y desuscribirte, visita http://archives.postgresql.org/pgsql-es-ayuda
>

Estimado :
Con que envio el correo solo una vez basta, ha llegado tres veces,
creo que si existe alguien de la lista que pueda respondder a tu duda
lo hara lo mas rapido posible, saludos.
J
-- 
----------------------
Slds.
jchavez
linux User #397972 on http://counter.li.org/



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group