Subject | Re: store procedure sintax: declare cursor |
---|---|
Author | Adam |
Post date | 2008-11-03T22:34:33Z |
--- In firebird-support@yahoogroups.com, "Fidel Viegas"
<fidel.viegas@...> wrote:
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
<fidel.viegas@...> wrote:
>I try to
> 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
> > create a SP like thisFROM vdq
> >
> > 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
> > INNER JOIN vd1 ON (vd1.codice=vdq.vd1_codice) WHERE id_Archivio =GROUP BY
> > i_id_archivio AND Archivio=i_archiviof AND vd2_codice=i_vd2_codice
> > vd1_codice, descrizione ORDER BY vd1_codice);Wrong!
> > ........
> >
> > END;
>
> Hi Fabio,
>
> Get rid of the variable keyword. That's not a valid PSQL syntax.
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