Write a function which accepts account no as input and prints the details of that account.
Write a function which accepts account no as input and prints the details of that account.
==--->>>
create or replace function ac(a int ) returns int as
'
declare
r1 account%rowtype;
ch int :=0;
begin
for r1 in select * from account where ano= a
loop
raise notice ''% % % % '',r1.ano,r1.atype,r1.odate,r1.balance;
ch:= ch+1;
end loop;
return ch;
end;
'language'plpgsql';
-----------------------------------------------------------------
Output of function
vasim2=# select ac(222);
o\p
vasim2=# select ac(222);
NOTICE: 222 zero 2006-12-04 ₹1,000.00
ac
----
1
(1 row)
===============================================================
0 Comments