"hints" formatted query output using oracle jdbc driver

301 Views Asked by At

Is it possible to get "hints" formatted query output using oracle jdbc driver?

example query

Select /*insert*/ * from sample_table

or

Select /*html*/ * from sample_table

looks like the stmt.executeQuer is just ignoring formatting "hints" and only return Select * results

        try {
            stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("Select /*insert*/ * from sample_table where ID = 1");

            while (rs.next()) {
                inserts.add(rs.getString(1));                    
            }
        } catch (SQLException e) {
            log.error("SQL Error", e);
        } finally {

UPD: As mentioned in the comments the /*insert*/ "hint" is specific to the SQL Developer and SQLcl clients.

I was able to get the query formatted output from SQLcl client enter image description here

The eventual goal is to get formatted query output from Java code. So re-phrasing the question: how to run query and get output through SQLcl using java ?

0

There are 0 best solutions below