Please help on MS SQL Procedure (@@rowcount) translate to Postgresql Function

Started by annachauover 23 years ago2 messagesgeneral
Jump to latest
#1annachau
annachau@hongkong.com

I have some MS SQL Store Procedure code as following:

update ot_ValReq
set delete_ind = 'Y'
where val_req_no in (@p_keys)

if @@rowcount = 0
begin
select @i_return = 3
goto error_handler
end

1. How can I get @@rowcount in postgresql or have any other method to check?
2. Can goto statement use in postgresql?

Thanks a lot.

#2Joe Conway
mail@joeconway.com
In reply to: annachau (#1)
Re: Please help on MS SQL Procedure (@@rowcount) translate

annachau wrote:

I have some MS SQL Store Procedure code as following:

[...snip...]

1. How can I get @@rowcount in postgresql or have any other method to check?
2. Can goto statement use in postgresql?

See:
http://developer.postgresql.org/docs/postgres/plpgsql.html

and in particular, look at the bottom of this page for the answer to #1:
http://developer.postgresql.org/docs/postgres/plpgsql-statements.html

and for alternatives for #2 see:
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html
and
http://developer.postgresql.org/docs/postgres/plpgsql-errors-and-messages.html

HTH,

Joe