Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: bitwise or on column

Re: bitwise or on column

From: Martin Haltmayer <Martin.Haltmayer_at_d2mail.de>
Date: Mon, 22 Jul 2002 13:01:40 +0200
Message-ID: <3D3BE614.4CFF6F48@d2mail.de>


Hi Stephan,

in 8.1.7.2.1 this one worked:

create or replace function bitor (i_bf in number) return number parallel_enable is

        l_retval number:= 0;
        l_bf number:= i_bf;
begin
        while l_bf > 0 loop
                l_retval:= l_retval + mod (l_bf, 2);
                l_bf:= trunc (l_bf/2);
        end loop;
        return l_retval;

end bitor;
/

Regards,

Martin

Stephan Bressler wrote:
>
> Hi all,
>
> I'm looking for a function doing a bitwise or on a column (number)
> containing permissions, e.g. 1=read, 2=write, 4=exec, ... (so 5 = exec+read
> permission).
> There are several rows per user and all permissions should be aggregated.
> The function should be used like
>
> select bitor(permissions)
> from acl
> where username='scott tiger';
>
> TIA
> Stephan
Received on Mon Jul 22 2002 - 06:01:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US