dbTalk Databases Forums  

stored proc returning single value

comp.databases.btrieve comp.databases.btrieve


Discuss stored proc returning single value in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
k.andris@gmail.com
 
Posts: n/a

Default stored proc returning single value - 11-14-2006 , 04:22 AM






Hello Folks!

How do I create a stored procedure, which returns a singel integer
value? I need to use the procedure in the following way:

SELECT name, age, myproc(age, height, weight) FROM people

the result would be a list of names, ages, and a value for each
calculated by myproc.

Is it possible with Pervasive 9?

Thanks.
A.


Reply With Quote
  #2  
Old   
Bill Bach
 
Posts: n/a

Default Re: stored proc returning single value - 11-14-2006 , 07:34 AM






Should be able to do it with the RETURNS clause:

CREATE PROCEDURE MyProc(IN :Val1 INTEGER,IN :Val2 INTEGER,
IN :Val3 INTEGER)
RETURNS(ID INTEGER);
BEGIN
SELECT Val1 + Val2 + Val3;
END;#

More cleanly, PSQLv9 has support for User-Defined Functions, which is
actually what you want.
Goldstar Software Inc.
Pervasive-based Products, Training & Services
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Chicago: Pervasive Service & Support Class - 03/2007 ***

k.andris (AT) gmail (DOT) com wrote:

Quote:
Hello Folks!

How do I create a stored procedure, which returns a singel integer
value? I need to use the procedure in the following way:

SELECT name, age, myproc(age, height, weight) FROM people

the result would be a list of names, ages, and a value for each
calculated by myproc.

Is it possible with Pervasive 9?

Thanks.
A.


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.