Subject RE: [firebird-support] SP with input parameter in a SELECT statem ent
Author Epstein, Ed
>>SELECT VAR1
FROM STOREDPROC(:VAR2)

But I get this prepare error:

Dynamic SQL Error
SQL error code = -206
Column unknown
VAR2

Executing the next statement gives no problem:

SELECT VAR1
FROM STOREDPROC(1)

The stored procedure is declared as (simplified, just for example):

CREATE PROCEDURE STOREDPROC(VAR2 INTEGER)
RETURNS (VAR1 INTEGER)
AS
BEGIN
VAR1 = 2*VAR2;
SUSPEND;
END

>>Can someone explain the error?

I am a little confused here. If you are trying to execute SELECT VAR1 FROM
STOREDPROC(1) outside of a SP then it should return 2 with no problem just
like you said.

However, you cannot pass it a parameter outside of a SP. If its inside
another SP you would have to have a variable defined to catch the output for
one thing. Inside the other SP you would execute
SELECT VAR1 FROM STOREDPROC(:VAR2) INTO :TEMP_VARIABLE;

VAR2 would be a passed parameter for SP executing the statement.

Hope this helps.



[Non-text portions of this message have been removed]