create table us_selections (
        selection_id    integer
			constraint us_selections_pk
			primary key
			constraint us_selections_id_fk
                        references acs_objects(object_id),
        package_id      integer
			constraint us_selections_pck_id_fk
                        references apm_packages(package_id),
        title           varchar2(255),
        description     varchar2(4000),
        full_sql        clob,
        bind_vars       varchar2(4000)
);

create table us_bind_vars (
        selection_id    integer
			constraint us_bind_vars_sel_id_fk
			references us_selections on delete cascade,
        name            varchar2(30),
        description     varchar2(4000),
        default_value   varchar2(4000),
	constraint us_bind_vars_pk
        primary key (selection_id, name)
);



-- Create the us_selection object type

begin
        acs_object_type.create_type (
                supertype       =>      'acs_object',
                object_type     =>      'us_selection',
                pretty_name     =>      'User Selection',
                pretty_plural   =>      'User Selections',
                table_name      =>      'us_selections',
                id_column       =>      'selection_id',
                name_method     =>      'us_selection.name'
        );
end;
/
show errors


@@users-selection-package.sql
