Rem
Rem $Header: exp_names.sql 25-jun-2003.16:50:59 gtang Exp $
Rem
Rem exp_names.sql
Rem
Rem Copyright (c) 2003, Oracle Corporation.  All rights reserved.  
Rem
Rem    NAME
Rem      exp_names.sql - Data Mining model export demo
Rem
Rem    DESCRIPTION
Rem      This script demonstrates the use of export_model(),
Rem      to export specific models in the user schema
Rem
Rem    NOTES
Rem     Prerequisits:
Rem     - directory object 'DM_DUMP' is already creaed
Rem     - the user has WRITE priviledge on 'DM_DUMP'
Rem     - named models have been created in the user schema
Rem
Rem    MODIFIED   (MM/DD/YY) 
Rem    gtang       06/25/03 - gtang_txn107754
Rem    gtang       06/25/03 - 
Rem    gtang       06/24/03 - Creation
Rem

DECLARE
  job_name   VARCHAR2(30) := 'mymodels';
  filter_str  VARCHAR2(100):=
      'name in (''ABN_CLAS_SAMPLE'',''ASSOCIATION_RULES_SAMPLE'',''NAIVE_BAYES_SAMPLE'')';
  v_err_msg VARCHAR2(200);
BEGIN 
  dmsys.dbms_data_mining.export_model(model_filter=>filter_str,
                                      filename=>job_name,
                                      directory=>'DM_DUMP',
                                      jobname=>job_name);
  dbms_output.put_line('dbms_data_mining.export_model: job '||job_name||
                       ' completed successfully!');
  
EXCEPTION
  WHEN OTHERS THEN 
    v_err_msg := SUBSTR(SQLERRM, 1, 200);
    dbms_output.put_line('EXPORT TEST failed! Error='||v_err_msg);

END;
/