Subject | Re: [firebird-support] store procedure sintax: declare cursor |
---|---|
Author | Fidel Viegas |
Post date | 2008-11-03T22:27:47Z |
On Mon, Nov 3, 2008 at 10:58 PM, Codebue Fabio - P-Soft
<f.codebue@...> wrote:
Get rid of the variable keyword. That's not a valid PSQL syntax.
You declare a variable like this:
declare <variable_name> <variable_type> ;
e.g.: declare i_archivio varchar(8);
Take care.
Fidel.
PS: Have a look at the firebirdsql.org for the interbase 6 manuals.
That should get you started with stored procedures.
<f.codebue@...> wrote:
> I'm using an 2.1 firebird server with a ODS 11.1 database but when I try toHi Fabio,
> 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;
Get rid of the variable keyword. That's not a valid PSQL syntax.
You declare a variable like this:
declare <variable_name> <variable_type> ;
e.g.: declare i_archivio varchar(8);
Take care.
Fidel.
PS: Have a look at the firebirdsql.org for the interbase 6 manuals.
That should get you started with stored procedures.