CREATE PROCEDURE "DA_APRIORI_PREPARE"(IN SCHEMANAME VARCHAR(100)) LANGUAGE SQLSCRIPT  SQL SECURITY INVOKER  AS BEGIN     DECLARE ROWCNT INTEGER;     DECLARE APRIORI_PDATA_TABLE TABLE ("POSITION" INT, "SCHEMA_NAME" NVARCHAR(256), "TYPE_NAME" NVARCHAR(256), "PARAMETER_TYPE" VARCHAR(7));     CALL DA_DROP_TYPE(:SCHEMANAME, 'DA_APRIORI_DATA_T');     EXECUTE IMMEDIATE 'CREATE TYPE DA_APRIORI_DATA_T AS TABLE(     "CUSTOMER" INTEGER,      "ITEM" VARCHAR(20));';     CALL DA_DROP_TYPE(:SCHEMANAME, 'DA_APRIORI_RESULT_T');     EXECUTE IMMEDIATE 'CREATE TYPE DA_APRIORI_RESULT_T AS TABLE(     "PRERULE" VARCHAR(500),     "POSTRULE" VARCHAR(500),     "SUPPORT" DOUBLE,     "CONFIDENCE" DOUBLE,     "LIFT" DOUBLE     );';     CALL DA_DROP_TYPE(:SCHEMANAME, 'DA_APRIORI_PMMLMODEL_T');     EXECUTE IMMEDIATE 'CREATE TYPE DA_APRIORI_PMMLMODEL_T AS TABLE(     "ID" INTEGER,     "PMMLMODEL" VARCHAR(5000)     );';     CALL DA_DROP_TYPE(:SCHEMANAME, 'DA_APRIORI_CONTROL_T');     EXECUTE IMMEDIATE 'CREATE TYPE DA_APRIORI_CONTROL_T AS TABLE(     "NAME" VARCHAR(100),     "INTARGS" INTEGER,     "DOUBLEARGS" DOUBLE,     "STRINGARGS" VARCHAR (100)     );';     SELECT COUNT(*) INTO ROWCNT FROM "PUBLIC"."M_TEMPORARY_TABLES" WHERE TABLE_NAME='#DA_APRIORI_PDATA_TBL' AND CONNECTION_ID=CURRENT_CONNECTION;     IF ROWCNT>0 THEN         DROP TABLE #DA_APRIORI_PDATA_TBL;     END IF;     CREATE LOCAL TEMPORARY COLUMN TABLE #DA_APRIORI_PDATA_TBL("POSITION" INT, "SCHEMA_NAME" NVARCHAR(256), "TYPE_NAME" NVARCHAR(256), "PARAMETER_TYPE" VARCHAR(7));     INSERT INTO #DA_APRIORI_PDATA_TBL VALUES (1, :SCHEMANAME, 'DA_APRIORI_DATA_T', 'IN');     INSERT INTO #DA_APRIORI_PDATA_TBL VALUES (2, :SCHEMANAME, 'DA_APRIORI_CONTROL_T', 'IN');     INSERT INTO #DA_APRIORI_PDATA_TBL VALUES (3, :SCHEMANAME, 'DA_APRIORI_RESULT_T', 'OUT');     INSERT INTO #DA_APRIORI_PDATA_TBL VALUES (4, :SCHEMANAME, 'DA_APRIORI_PMMLMODEL_T', 'OUT');     APRIORI_PDATA_TABLE = SELECT * FROM #DA_APRIORI_PDATA_TBL;     CALL "SYS".AFLLANG_WRAPPER_PROCEDURE_DROP(:SCHEMANAME, 'DA_APRIORI_RULE_PROC');     CALL "SYS".AFLLANG_WRAPPER_PROCEDURE_CREATE('AFLPAL', 'APRIORIRULE', :SCHEMANAME, 'DA_APRIORI_RULE_PROC', :APRIORI_PDATA_TABLE);     DROP TABLE #DA_APRIORI_PDATA_TBL; END