Subject Re: [firebird-support] Select from SP in a view
Author Helen Borrie
At 10:15 AM 25/07/2003 +0700, you wrote:
>Hi,
>
>I need to select a value form store procedure in a view. I have the following
>sql statement:
>
>CREATE VIEW vPA
>(
>category,
>description,
>CatDetID,
>pointdescr,
>typepa,
>)
>AS
>SELECT FIRST 100
>a.category,
>a.description,
>b.CatDetID,
>b.pointdescr,
>sp_small_vPA.SupervisorF
>FROM sp_small_vPA, evalcattab a INNER JOIN
>evalcatdet b ON a.category = b.category
>;
>
>I have an error on sp_small_vPA.

1) What's the error?

>The procedure itself is working. I can select the value from the store
>procedure.

2) 1.5 won't allow you to use mixed implicit and explicit join syntax -
you can use either one, but not mix both. (This is Firebird protecting you
from yourself :-))

3) There are no criteria for joining sp_small_vPA.

4) I'm almost sure that 1.5 won't let you mix table aliases with direct
table identifiers in the same statement - in which case you'll need to use
an alias for sp_small_vPA.

SELECT FIRST 100
a.category,
a.description,
b.CatDetID,
b.pointdescr,
s.SupervisorF
FROM sp_small_vPA s
JOIN evalcattab a ON s.??? = a.??? <--- need join criteria here
JOIN evalcatdet b ON a.category = b.category ;

One more...I have little doubt lurking somewhere that you can't use SELECT
FIRST in a view. That could be a delusion, however...

heLen