------------------------------------------------------------------------------- 
-- 
--  @Copyright (c) 2002, Oracle Corporation. All rights reserved. 
--  @headcom 
-- 
--  Template registration script for database providers.
-- 
--  This script contains the template code for registering a database provider
--  with the portal.
--  
--  This script should run in the portal schema or the provider schema.  If
--  it is executed in the provider schema a portal session should be
--  established first using the API wwctx_api.set_context.
-- 
--  @usage   execute in portal or provider schema
-- 
--  @scope   Public 
-- 
------------------------------------------------------------------------------- 

set serveroutput on size 1000000

prompt 'Database provider registration script'
declare
    l_db_provider wwpro_api_provider_registry.provider_record;
    l_provider_id number;
begin

    l_db_provider.name := <provider_name>;
    l_db_provider.timeout := <timeout_value>;
    l_db_provider.implementation_style := wwpro_api_provider_registry.DATABASE_IMPL;
    l_db_provider.login_frequency := <login_frequency>;
    l_db_provider.implementation_name := <impl_name>;
    l_db_provider.implementation_owner := <impl_owner>;

    l_provider_id := wwpro_api_provider_registry.register_provider(l_db_provider);
    commit;

    wwpro_api_provider_registry.print_provider(
        p_id => l_provider_id,
        p_language => wwnls_api.AMERICAN
    );

exception
    when others then
        dbms_output.put_line('Error: ' || l_db_provider.name || ' did not successfully register');
        dbms_output.put_line('Error code: ' || to_char(sqlcode));
        dbms_output.put_line('Error message: ' || sqlerrm);
        dbms_output.put_line('Error stack: ' || substr(
            wwerr_api_error_ui.get_text_errors(),1,220));
end;
/


