我在我的 web 应用程序中的 mysql 中有四个查询,我试图将它们转换为 oracle 查询。但是,当我尝试运行新查询时,日期时间字符串会中断。有人可以帮我弄清楚我做错了什么吗?
PostreSQL 查询:-
插入 o_stat_daily (businesspath,resid,day,value)
(select businesspath, int8(substring(businesspath from position(':' in businesspath) + 1 for position(']' in businesspath) - position(':' in businesspath) - 1)), date_trunc('day',creationdate) as d, count(*) as c from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d);插入 o_stat_weekly (businesspath,resid,week,value)
(select businesspath, int8(substring(businesspath from position(':' in businesspath) + 1 for position(']' in businesspath) - position(':' in businesspath) - 1)), to_char(creationdate, 'IYYY') || '-' || to_char(creationdate, 'IW') as d, count(*) as c from o_loggingtable where actionverb='launch' and actionobject='node ' and businesspath != '' group by businesspath, d);插入 o_stat_dayofweek (businesspath,resid,day,value)
(select businesspath, int8(substring(businesspath from position(':' in businesspath) + 1 for position(']' in businesspath) - position(':' in businesspath) - 1)), int8(to_char(creationdate, 'D')) as d, count(*) as c from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d );插入 o_stat_hourofday (businesspath,resid,hour,value)
(select businesspath, int8(substring(businesspath from position(':' in businesspath) + 1 for position(']' in businesspath) - position(':' in businesspath) - 1)), int8(to_char(creationdate, 'HH24')) as d, count(*) as c from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d );
甲骨文查询:-
插入 o_stat_daily (businesspath,resid,day,value)
(select businesspath, convert(substr(businesspath, locate(':', businesspath) + 1, locate(']', businesspath) - locate(':', businesspath) - 1), int), convert(creationdate,date) d, count(*) c from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d);插入 o_stat_weekly (businesspath,resid,week,value)
(select businesspath, convert(substr(businesspath, locate(':', businesspath) + 1, locate(']', businesspath) - locate(':', businesspath) - 1), int), year(creationdate)+ '-'+repeat('0',2-length(convert((dayofyear(creationdate)-dayofweek(creationdate))/7,varchar(7))))+ convert((dayofyear(creationdate)-dayofweek(creationdate))/7,varchar(7)) d, count(*) c from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by商业路径,d);插入 o_stat_dayofweek (businesspath,resid,day,value)
(select businesspath, convert(substr(businesspath, locate(':', businesspath) + 1, locate(']', businesspath) - locate(':', businesspath) - 1), int), dayofweek(creationdate) d, count(*) c from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d);插入 o_stat_hourofday (businesspath,resid,hour,value)
(select businesspath, convert(substr(businesspath, locate(':', businesspath) + 1, locate(']', businesspath) - locate(':', businesspath) - 1), int), hour(creationdate) d, count(*) c from o_loggingtable where actionverb='launch' and actionobject='node' and businesspath != '' group by businesspath, d);