Re: Creating functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/4/26 Félix Sánchez Rodríguez <fesanch@xxxxxxxxxxxxx>:
> Are the functions in PostgreSQL like the Stored Procedures on SQL Server??
> If so, could someone post a simple function which for instance inserts a new
> record. I just want to have a preview of the syntax of the code. I later
> will look up some documentation on this subject.

There are lots of examples in the docs, but here's a super simple one in sql:

# create table test (a int);
# create function addone(x int) returns int as $$
# insert into test (a) values ($1); select $1;
$$ language sql;
# select addone(5);
 addone
--------
      5
(1 row)
# select * from test;
 a
---
 5
(1 row)

-- 
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux