Reputation: 19
in mysql we use ` sign before and after column name in query
i want support both oracle and mysql but in oracle ` not support and it most be change to "
is ther anyway to force oracle use ` instead of " for before and after column ?
for example this is my mysql query
SELECT * FROM `md_menu` where `place`='1' AND `adminid`='1' ORDER BY `order` ASC
but it most be change for oracle to this
SELECT * FROM "md_menu" where "place"='1' AND "adminid"='1' ORDER BY "order" ASC
is ther any way?
Upvotes: 0
Views: 79
Reputation: 887
IMO instead of forcing oracle
follow mysql
syntax, it will be easier just make mysql
follow standard ASCI syntax :
add this line at the top of your mysql syntax, then the identifier change to "
for object, '
for string, just like oracle
.
SET SESSION sql_mode = 'ANSI';
here is some demonstration :
SET SESSION sql_mode = 'ANSI';
create table "a"
(
id int,
col varchar(1)
);
insert into "a" values (1,'1');
insert into "a" values (2,'2');
select * from "a" where col = '1'
also db<>fidddle.
and I totally agree @P.Salmon mention in comment, avoid using reserved word as object name.
Upvotes: 1