Subject Re: invalid request BLR at offset 383 BLR syntax error......
Author Adam
--- In firebird-support@yahoogroups.com, "Leonardo Cosmai"
<leonardo.cosmai@...> wrote:
>
> --- In firebird-support@yahoogroups.com, "Ann W. Harrison"
> <aharrison@> wrote:
> >
> > Leonardo Cosmai wrote:
> >
>
> > One idea is to upgrade to 1.5.3, which fixes a bunch of bugs. Other
> > ideas will need more information. Firebird is not natively a SQL
> > engine. It runs a very general binary relational language called
> > BLR that was designed for machine generation. Constructions of
> > SQL, QUEL, and Data Language can be represented in BLR. So, your
> > error says that something went wrong in the translation of your
> > query to BLR... Now, that could be just your statement, though
> > that's unlikely. Or it could be a stored procedure. Or it could
> > be a reference to an external function.... If you can identify
> > the statement associated with the error, that would be a great
> > step forward.
>
> Sorry for the delay...
>
> This is the statement:
>
> SELECT A.* FROM A INNER JOIN A_STORE_PROCEDURE(?,?) B ON (A.COL1 =
B.COL1)
>
> where A_STORE_PROCEDURE is really a simple FOR SELECT.....

The optimiser may be placing A_STORE_PROCEDURE first, and as a result
it does not have the results from A to use as input parameters. You
need to force table A to be used before the stored procedure to avoid
this. You can do this with a left join, and use the where clause to
prevent the potential nulls on the right table

SELECT A.*
FROM A
LEFT JOIN A_STORE_PROCEDURE(?,?) B ON (A.COL1 = B.COL1)
WHERE B.COL1 IS NOT NULL

Is logically equivalent but should work.

Adam