Forum OpenACS Development: Re: Scalability of acs_objects and acs_object_context_index

Here is the version that is both - textbook-compliant (no magic hardcoded values in your SQL script) and efficient (only *one* substitution at creation time, never ever during run-time):

column magic_object_id new_value MAGIC_OBJECT_ID
select acs.magic_object_id('the_public') MAGIC_OBJECT_ID from dual;

create or replace view foobar as select * from
  acs_permissions
  where grantee_id = &MAGIC_OBJECT_ID;