Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PostgreSQL Stored Proc
Message
From
02/11/2001 15:40:33
 
 
To
All
General information
Forum:
Linux
Category:
Databases and Admin issues
Title:
PostgreSQL Stored Proc
Miscellaneous
Thread ID:
00576980
Message ID:
00576980
Views:
50
Okay, here's another one I can't seem to find out!

How do I create stored proc in PostgreSQL? I have found the CREATE FUNCTION command, but from what I can tell, it only returns a single value.

I'd like to have a proc that will, for example, return the fields of a single record whose primary key is passed as a parameter to the stored proc. With SQL Server, I would do something like:
CREATE PROCEDURE test
    @ID  INT
AS
SELECT * FROM TableName
    WHERE ID = @ID
And I could run it using EXEC test 3 to get the record with ID = 3.

Can this be done in PostgreSQL?

Thanks!
Sylvain Demers
Next
Reply
Map
View

Click here to load this message in the networking platform