Обсуждение: Re: [GENERAL] Re: [HACKERS] [Fwd: SGVLLUG Oracle and Informix on Linux]

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

Re: [GENERAL] Re: [HACKERS] [Fwd: SGVLLUG Oracle and Informix on Linux]

От
Herve Lefebvre
Дата:
---Bruce Tong <zztong@laxmi.ev.net> wrote:
> > features != ANSI SQL compliance, right?
>
> I suppose ANSI SQL is the heart of it.
>
> > Again, what are we missing that Oracle currently has...?
>

Stored procedures with tuples resultset:

SELECT F1,F2,F3 FROM TABL1

And Multi-resultsets stored-procedures:

SELECT F1,F2 FROM TABLE1
SELECT F3,F4,F5 FROM TABLE2

And how can we declare/use variables with PG-SQL ?

With Sybase (and oracle) I can do that:

PROCECURE p (@org_account int, @dest_account int, @amount money)
as
   DECLARE @balance money
   BEGIN TRAN
      SELECT @balance=balance
      FROM account_table
      WHERE @account_num=@org_account

      /* Check if enough money on the account */
      IF @balance<@amount
      BEGIN
         ROLLBACK TRAN
         RETURN -1 /* Not enough money */
      END

   /* proceed with the updates */
       ...

   COMMIT TRAN
   RETURN 0
go

How to do a such stored procedure with pgSQL ? (please, don't say me
to write it in C language ).

--
H.L.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com