dbTalk Databases Forums  

Calling Functions and Stored Procedures

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Calling Functions and Stored Procedures in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark Dexter
 
Posts: n/a

Default Calling Functions and Stored Procedures - 07-15-2004 , 10:43 AM






Quote:
I understand that functions in Postgres server the purpose of both
functions and stored procedures in other db's (e.g., MSSQL and
Oracle). In these other databases, you call a stored procedure with
different syntax (e.g., CALL <procedure name>) instead of using it in
line in a SELECT statement.

My question is this: If I write a Postgres function that is not
designed to be part of a query (e.g., it should just do something), do
I still use a SELECT statement to execute the function? Is there some
other syntax that is the equivalent to CALL or EXEC?

Thanks for your help.


Reply With Quote
  #2  
Old   
Oliver Elphick
 
Posts: n/a

Default Re: Calling Functions and Stored Procedures - 07-15-2004 , 11:46 AM






On Thu, 2004-07-15 at 16:43, Mark Dexter wrote:
....
Quote:
My question is this: If I write a Postgres function that is not
designed to be part of a query (e.g., it should just do something), do
I still use a SELECT statement to execute the function? Is there some
other syntax that is the equivalent to CALL or EXEC?
No, you always use SELECT to call a function.

For example, to change the value of a sequence (using a built-in
function):

SELECT nextval('table_field_seq',553);


Oliver Elphick


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings



Reply With Quote
  #3  
Old   
Scott Marlowe
 
Posts: n/a

Default Re: Calling Functions and Stored Procedures - 07-18-2004 , 05:39 PM



On Wed, 2004-07-14 at 19:21, Mark Dexter wrote:
Quote:
I understand that functions in Postgres server the purpose of both
functions and stored procedures in other db's (e.g., MSSQL and
Oracle). In these other databases, you call a stored procedure with
different syntax (e.g., CALL <procedure name>) instead of using it in
line in a SELECT statement.

My question is this: If I write a Postgres function that is not
designed to be part of a query (e.g., it should just do something), do
I still use a SELECT statement to execute the function? Is there some
other syntax that is the equivalent to CALL or EXEC?
Nope, you still use the select function() syntax for that too.


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.