Subject [firebird-support] View with select procedure
Author Daniel L. Miller
Hi all.

I appear to be causing Firebird some difficulty - am I doing this
incorrectly?

Platform - Linux & v1.5

I have an "addresses" view, created from an address, city, state,
zipcode tables, i.e.
ADDRESS
id
street
zipcode
ZIPCODES
zipcode
city
state

ADDRESSES
address.id
street
city
state
zipcode

OK - this works. Now I have a select procedure for creating a "full"
street address from the address, street, street type, and suite (I just
pasted the metadata from ibwebadmin) -
ALTER PROCEDURE GETFULLSTREET (ADDRESS_ID INTEGER)
RETURNS (RETFULLSTREET VARCHAR(114) CHARACTER SET NONE)
AS

DECLARE VARIABLE address VARCHAR( 10 );
DECLARE VARIABLE street VARCHAR( 50 );
DECLARE VARIABLE street_type_id INTEGER;
DECLARE VARIABLE street_type VARCHAR( 30 );
DECLARE VARIABLE suite VARCHAR( 20 );
BEGIN
SELECT address,street,street_type_id,suite FROM address WHERE id =
:address_id INTO :address,:street,:street_type_id,:suite;

SELECT street_type FROM street_types WHERE id = :street_type_id INTO
:street_type;

retfullstreet = '';
IF (address IS NOT NULL) THEN
retfullstreet = address || ' ';
IF (street IS NOT NULL) THEN
retfullstreet = retfullstreet || street || ' ';
IF (street_type IS NOT NULL) THEN
retfullstreet = retfullstreet || street_type || ' ';
IF (suite IS NOT NULL) THEN
retfullstreet = retfullstreet || suite;

SUSPEND;
END ^

The select procedure works. I can create a new view, using only a table
and this procedure. But when I try to create a view that uses another
view as the source along with the select procedure - I get a lockup.
Should I be able to do this?

--
Daniel