Subject Introduction to stored procedures
Author Henk van der Meer
Hello,

Now and again I am trying to start using stored procedures. I am a
professional software developer and have written software in the general
languages (c, c++, pascal, basic,.), but the how and why of stored
procedures still escapes me; especially the how.


For example I am trying to write a stored procedure that takes two integer
parameters A and B. If A isn't NULL it returns A else it returns B. I use
the integers as id's.

Suppose the stored procedure is called P_A_OR_B.

I am able to use it like this: select * from P_A_OR_B(1,1). But not like
this:

Select * from table_x x
Join table_y y on y.id = P_A_OR_B(x.id1,x.id2)

The most frustrating thing is the error message: function unknown.

I have lots of questions but will start with 2.

1) If the stored procedure was written properly would the second usage (the
join) be possible?

2) What can I read to start using and understanding stored procedures? The
only thing I found so far is:
Introduction to InterBase Stored Procedures and Triggers
By Bill Todd, Borland Developers Conference San Diego 2000.


Thank you.

Henk van der Meer