variables outside of functions

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

variables outside of functions

От:
"Ketema J. Harris" <ketema@ketema.net>
Дата:
Вложения:
Is it possible to write a block of sql statements that utilize variables?  I can use variables easy enough inside of a function, but I was attempting to do something very transactSQL like and kepte running into problems.  I would like to do something similar to:

declare
var1 int;
var2 int;
var3 int;

begin
var3 = var1 + var2;
select var3 as addition;
end

is this possible?  Thanks.

Ketema J. Harris
www.ketema.net


Re: variables outside of functions

От:
Andreas Kretschmer <akretschmer@spamfence.net>
Дата:
Ketema J. Harris  schrieb:

> Is it possible to write a block of sql statements that utilize  variables?  
> I can use variables easy enough inside of a function, but  I was attempting 

You can use languages like plperl to use variables within one session.
(persistent variables, a little example with german comments are here:
http://a-kretschmer.de/pgsql/pgsql-4.php, function prev_saldo)


HTH, Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°
FAQ