we'd have to parse the columns first to see if we found any functions to know if we should quote them, and that's expensive
in your case i'd create a view probably
I'm pretty sure you are already parsing columns, because they are actually listed in the query one-by-one instead of *'ing.
In fact, this query, which is run before I first go to the data tab:
SELECT 'COLUMN' type, owner, table_name object_name, column_name, column_id, data_type FROM sys.all_tab_cols WHERE hidden_column = 'NO' and rownum <=999 and owner = ? and table_name = ?
is exactly for parsing columns. Also, keywords like "index" are already double-quoted, like I've mentioned. It looks like it's already 2/3 done anyway, just need some keyword list expansion =)
Also, keywords like "index" are already double-quoted, like I've mentioned. It looks like it's already 2/3 done anyway, just need some keyword list expansion =)
If a 'solution' were really needed the simplest one would just be to quote ALL of the columns in the query.
Lower-case names are already quoted when needed but upper-case names aren't. That seems to suggest that Sql dev is already doing some parsing/checking in order to know that a column with lower-case or special characters needs to be quoted.
create table a_table ("abc" number, abc number, "current_date" varchar2(10), current_date varchar2(10));
insert into a_table values (1, 2, 'lower_date', 'upper_date');
Modified SQL: SELECT ROWID "ROWID", ORA_ROWSCN "ORA_ROWSCN", "abc" "abc", ABC ABC, "current_date" "current_date", CURRENT_DATE CURRENT_DATE FROM "SCOTT"."A_TABLE"
The two column names that are case-sensitive were quoted.