I have an Oracle database server running on a machine. Clients performs operations through a frontend application build from a different company, which generates corresponding SQL queries for these operations.
The frontend application generates SQL queries that we cannot modify. What I would like to know if there is any way to rewrite the SQL query upon its arrival. More specifically, we would like to be able to change tablespace names, default attribute values and most importantly compression parameters. For example, change this query:
CREATE TABLE EXAMPLE_TABLE (
ID INTEGER NOT NULL,
AMOUNT FLOAT(126) DEFAULT 0.0,
TAG VARCHAR2(50) DEFAULT ' '
)
TABLESPACE EXAMPLE_TABLESPACE NOCOMPRESS
to:
CREATE TABLE EXAMPLE_TABLE (
ID INTEGER NOT NULL,
AMOUNT FLOAT(126) DEFAULT 2.0,
TAG VARCHAR2(50) DEFAULT ' '
)
TABLESPACE EXAMPLE_TABLESPACE_TWO COMPRESS FOR OLTP
Note that the rewrites are not limited to create table statements, but can be applied to any SQL queries.
Any ideas about how to do this?
CREATE TABLE ...is not a SQL query. If you would talk about real queries (i.e.SELECTor any DML) such rewrite would be no problem. However, in your case it will end up in the frontend application must not invoke any SQL commandcreate table. I don't think there is a database way to do what you want.