Обсуждение: Please help on MS SQL Procedure (@@rowcount) translate to Postgresql Function

Поиск
Список
Период
Сортировка

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

От
"annachau"
Дата:
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.

Re: Please help on MS SQL Procedure (@@rowcount) translate

От
Joe Conway
Дата:
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