Subject Re: store procedure sintax: declare cursor
Author Adam
--- In firebird-support@yahoogroups.com, "Fidel Viegas"
<fidel.viegas@...> wrote:
>
> On Mon, Nov 3, 2008 at 10:58 PM, Codebue Fabio - P-Soft
> <f.codebue@...> wrote:
> > I'm using an 2.1 firebird server with a ODS 11.1 database but when
I try to
> > create a SP like this
> >
> > CREATE PROCEDURE p_n AS
> >
> > declare variable i_archivio varchar(8);
> > declare variable i_id_archivio integer;
> > declare variable i_vd2_codice varchar(8);
> > declare variable i_vd3_codice varchar(8);
> >
> > declare variable FETCH_STATUS_Colors integer;
> > declare variable FETCH_STATUS_Seqs integer;
> > declare variable vd1_sequenza integer;
> > declare variable vdc_sequenza integer;
> > declare variable qta integer;
> > declare variable str_sequenza char(3);
> > declare variable str_qta char(6);
> > declare variable str_sequenze varchar(100);
> > declare variable str_qtas varchar(100);
> > declare variable vd1_codice varchar(8);
> > declare variable vd1_descrizione varchar(40);
> > declare variable rows_counter integer;
> >
> > BEGIN
> >
> > i_id_archivio= 25;
> > i_archivio= 'OVR';
> > i_vd2_codice= 'SHIRT';
> > i_vd3_codice= 'SPRT';
> >
> > declare variable Colors CURSOR FOR (SELECT vd1_codice, descrizione
FROM vdq
> > INNER JOIN vd1 ON (vd1.codice=vdq.vd1_codice) WHERE id_Archivio =
> > i_id_archivio AND Archivio=i_archiviof AND vd2_codice=i_vd2_codice
GROUP BY
> > vd1_codice, descrizione ORDER BY vd1_codice);
> > ........
> >
> > END;
>
> Hi Fabio,
>
> Get rid of the variable keyword. That's not a valid PSQL syntax.

Wrong!

It is valid (but optional) syntax to include the word variable. I
don't use CURSOR myself, so I don't know if that is valid syntax, nor
whether is it legal after the BEGIN as in this example, but the rest
of the variable declarations look OK at a quick glance.


Adam