From: | "Andre Schnoor" <andre(dot)schnoor(at)web(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Moving from Sybase to Postgres - Stored Procedures |
Date: | 2005-01-29 00:19:04 |
Message-ID: | 36031vF4rnga0U1@individual.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
<mmiranda(at)americatel(dot)com(dot)sv> schrieb im Newsbeitrag
news:76E0DAA32C39D711B6EC0002B364A6FA03F0A7FD(at)amsal01exc01(dot)americatel(dot)com(dot)sv(dot)(dot)(dot)
> > CREATE PROCEDURE do_something
> > @song_id int,
> > @user_id int,
> > @method int,
> > @length int = 0,
> > @date_exact datetime,
> > @default_country int = null
> > AS
> > -- temporary variables
> > DECLARE
> > @artist int,
> > @sample int,
> > @date varchar(32),
> > @country int
> > BEGIN
> > -- assign temporary variables
> > select @date = convert(varchar(32),@date_exact,101)
> > select @artist = user_id, @sample = is_sample from sto_song where
> > song_id = @song_id -- perform conditional code
> > if (@sample = 1) begin
> > begin transaction
> > ... do something ...
> > commit transaction
> > end else begin
> > ... do something else ...
> > end
> > -- return results
> > select
> > result1 = ... some expression ...,
> > result2 = ... another expression ...
> > END
> >
> > I could not yet translate this to PgSQL, as I can't find any control
> > structures, variable declaractions, etc.
> > Am I missing something important?
> >
>
> Absolutely, that is a perfectly normal SP, i use those constructors
> everyday, maybe you dont have searched in the docs?.
> Perl?, i dont think so, PL/pgSQL is all what you need,
>
Yes, oops. I have overlooked this.
It wasn't listed where I expected it, sorry.
Greetings,
Andre
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Benoit | 2005-01-29 00:46:43 | Postgresql v8.0 debian packages. |
Previous Message | Tom Lane | 2005-01-29 00:08:21 | Re: rowset-returning function mismatch |