Chuyên mục
Internet

Tutorial 42 – Creating Functions in PostgreSQL

Rate this post



Learn about Creating Functions in PostgreSQL.

Tag: postgresql function, [vid_tags]

Xem thêm: https://meohay360.com/category/internet

Nguồn: https://meohay360.com

19 trả lời trong “Tutorial 42 – Creating Functions in PostgreSQL”

All code typed in the video:

create or replace function total()
returns integer as $total$
declare
total integer;
begin
select count(*) into total from company;
return total;
end;
$total$ language plpgsql;

select total()

create or replace function inc(value integer)
returns integer as $inc$
begin
returns value+1;
end;
$inc$ language plpgsql;

select inc(4);
select inc(6);
select inc(10);

create function sum(val1 integer, val2 integer)
returns integer as $sum$
begin
return val1+val2;
end;
$sum$ language plpgsql;

select sum(20, 30);

Trả lời

Email của bạn sẽ không được hiển thị công khai.