postgresql7.1 select calendar__new( null, :calendar_name, 'calendar', :owner_id, :private_p, :package_id, null, now(), :creation_user, :creation_ip ); select calendar__name(:calendar_id) from dual select calendar_name, calendar_id, acs_permission__permission_p(calendar_id, :user_id, 'calendar_admin') as calendar_admin_p from calendars where (private_p = 'f' and package_id = :package_id $permissions_clause) or (private_p = 't' and owner_id = :user_id) order by private_p asc, upper(calendar_name) and acs_permission__permission_p(calendar_id, :user_id, :privilege) = 't' select calendar__delete(:calendar_id)