1/* 2 * Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the Eclipse Public License v. 2.0, which is available at 6 * http://www.eclipse.org/legal/epl-2.0. 7 * 8 * This Source Code may also be made available under the following Secondary 9 * Licenses when the conditions for such availability set forth in the 10 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 * version 2 with the GNU Classpath Exception, which is available at 12 * https://www.gnu.org/software/classpath/license.html. 13 * 14 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 */ 16 17SET SERVEROUTPUT ON; 18 19DECLARE 20 vCtr Number; 21 vSQL VARCHAR2(1000); 22 vcurrSchema VARCHAR2(256); 23BEGIN 24 25 SELECT sys_context( 'userenv', 'current_schema' ) into vcurrSchema from dual; 26 dbms_output.put_line('Current Schema: '||vcurrSchema); 27 28 SELECT COUNT(*) 29 INTO vCtr 30 FROM user_tables 31 WHERE table_name = 'STEPSTATUS'; 32 33 IF vCtr = 0 THEN 34 dbms_output.put_line('Creating STEPSTATUS table'); 35 vSQL := 'CREATE TABLE STEPSTATUS 36 ( 37 id NUMBER(19,0) PRIMARY KEY, 38 obj BLOB, 39 CONSTRAINT STEPSTATUS_STEPEXEC_FK FOREIGN KEY (id) REFERENCES STEPEXECUTIONINSTANCEDATA (stepexecid) ON DELETE CASCADE 40 )'; 41 EXECUTE IMMEDIATE vSQL; 42 END IF; 43 44END; 45/ 46