Subject Re: Dynamic name in a stored procedure
Author randallsell
--- In firebird-support@yahoogroups.com, Svein Erling Tysvær
<svein.erling.tysvaer@...> wrote:
>
> Hi Randall.
>
> I'd say you have at least two other alternatives:
>
> 1) Write things directly in your stored procedure:
>
> DECLARE VARIABLE DOFULL SMALLINT;
> BEGIN
> DOFULL = 1;
> IF (DOFULL = 1) then
> FOR SELECT
> DESCRIPTION,
> COMPANYNAME
> FROM PASWORD_VIEW_FULL
> INTO
> :DESCRIPTION,
> :COMPANYNAME
> DO BEGIN
> SUSPEND;
> END
> ELSE
> FOR SELECT
> DESCRIPTION,
> COMPANYNAME
> FROM PASWORD_VIEW_LITE
> INTO
> :DESCRIPTION,
> :COMPANYNAME
> DO BEGIN
> SUSPEND;
> END
> END
>
> The drawback is that this is verbose, and quickly gets complicated
if you have lots of conditions.
>
> 2) Replace your views with a single view with a where clause similar to:
>
> WHERE <FieldName> = <condition> or CURRENT_USER = <whomever is to be
given full access>
>

You are a blinkin' genious! thank you. I figured the answer was
something obvious. And as it turns out I missed the forest through the
trees.

thanx again.
-randall