私の webapp の mysql には、oracle クエリに変換しようとしている 4 つのクエリがあります。ただし、新しいクエリを実行しようとすると、日時文字列が壊れます。誰かが私が間違っていることを理解するのを手伝ってくれますか?
PostreSQL クエリ:-
insert into o_stat_daily (businesspath,resid,day,value)
(select businesspath, int8(substring(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);insert into o_stat_weekly (businesspath,resid,week,value)
(select businesspath, int8(substring(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);insert into o_stat_dayofweek (businesspath,resid,day,value)
(select businesspath, int8(substring(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 );insert into o_stat_hourofday (businesspath,resid,hour,value)
(select businesspath, int8(substring(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);insert into 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);insert into 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) に挿入します (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);