Subject [firebird-support] Dynamic name in a stored procedure
Author Randall Sell
Can someone please tell me where this is wrong? And what the correct SQL syntax should be? I'm trying to get my stord procedure to return results from one of 2 views based on a condiiton. SourceView should have one of two view names. But it is not happy compiling:

DECLARE VARIABLE DOFULL SMALLINT;
DECLARE VARIABLE SOURCEVIEW Char(20);
BEGIN
DOFULL = 1;
IF (DOFULL = 1) then
SOURCEVIEW = 'PASWORD_VIEW_FULL';
ELSE
SOURCEVIEW = 'PASWORD_VIEW_LITE';
FOR SELECT
DESCRIPTION,
COMPANYNAME
FROM :SOURCEVIEW <--- not happy with this
INTO
:DESCRIPTION,
:COMPANYNAME
DO BEGIN
SUSPEND;
END
END


thanx
-randall


---------------------------------
Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.

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