// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class OraGlbTbl {
    public static void main(String[] args) throws Exception{
        Class.forName("oracle.jdbc.OracleDriver");
        Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:arnepc3", "xxxx", "xxxx");
        Statement stmt = con.createStatement();
        stmt.executeUpdate("CREATE GLOBAL TEMPORARY TABLE tbl_names(ids NUMBER(19)) ON COMMIT PRESERVE ROWS");
        stmt.executeUpdate("INSERT INTO tbl_names VALUES(123)");
        stmt.executeUpdate("TRUNCATE TABLE tbl_names");
        stmt.executeUpdate("DROP TABLE tbl_names");
        con.close();
    }
}
