On Tue, Feb 28, 2012 at 9:50 AM, Rehan Saleem <pk_rehan@yahoo.com> wrote:
> hi ,
> how can i convert this sql store procedure to postgresql function , i shall
> be very thankful to you, as i am new to postgresql and i dont know how to
> handle this kind of store procedure in postgresql
Most people handle this with user-defined functions (UDF) written in
PL/PgSQL procedural language.
Try to read The Friendly Manual
http://www.postgresql.org/docs/current/static/sql-createfunction.html
http://www.postgresql.org/docs/current/static/plpgsql.html
Don't worry - all Transact-SQL constructs have their equivalent.
Just start rewriting your function and begin asking specific questions
here... People will help.
I would begin with
create or replace function sp_GetUserByID( in_UserId varchar(50), ...)
returns varchar(50)
language plpgsql as $$
declare
...
begin...return somevariable;
end;
$$;
HTH,
Filip