Posts

Showing posts with the label oracle12c

Oracle session timezone: Can Oracle DB session convert java.sql.Date to correct timezone?

Image
Clash Royale CLAN TAG #URR8PPP Oracle session timezone: Can Oracle DB session convert java.sql.Date to correct timezone? We have an audit table( Columns/Types: ID/Number,.. Audited_Date/Date) which logs audit entries using prepared statements. Until now, for different contexts we set the database session timezone for the connection, after which we were using the CURRENT_DATE attribute for the audited_date column. THIS MEANT THAT THE DATE INSERTED INTO THE COLUMN IS IN THE TIMEZONE OF THE CONNECTION WHICH IS IMPORTANT. Now, we have a new requirement to add different dates based on the supplied timestamps for the audit logs. Similar to the previous approach where the auditing engine didn't have to worry about the timezone, is there a way to set the date for the column, WITHOUT having to do something like this: TimeZone timeZone = TimeZone.getTimeZone(timezone); calendar.setTimeZone(timeZone); preparedStatement.setDate(4, new java.sql.Date(userTimestampMillis), calendar); I would real...

Fluent Hibernate Mappings broken after Upgrade from Oracle 11 to 12 c

Image
Clash Royale CLAN TAG #URR8PPP Fluent Hibernate Mappings broken after Upgrade from Oracle 11 to 12 c I have the following mapping file: public Fabrication_TemplatesMap() { { LazyLoad(); Table("Fabrication_Templates"); Id(x => x.Fab_Tmpl_Id).GeneratedBy.Sequence("S_FAB_TMPL_ID"); Map(x => x.Fab_Tmpl_Guid); Map(x => x.Status_Id); Map(x => x.Fab_Tmpl_xml, "FAB_TMPL_XML"); References(f => f.fabricationrecord, "FAB_TMPL_ID").Cascade.None().Not.LazyLoad().ForeignKey("FAB_TMPL_ID").ReadOnly(); References(x => x._Status, "STATUS_ID").Cascade.None().Not.LazyLoad().ForeignKey("STATUS_ID").ReadOnly(); } } After the DBA updated the server to Oracle 12 c from 11 something, the mapping stopped completely working. It fills in Fab_Tmpl_Id and Fab_Tmpl_Guid, but everything else is null now. I am a...

How to generate timeseries data into table in Oracle PL/SQL between two date using interval 1 minute?

How to generate timeseries data into table in Oracle PL/SQL between two date using interval 1 minute? I am new in this topic. In my setup Oracle 12c Standart Edition database and PL/SQL Developer. I have a table which has the following structure: int id; timestamp time_mon; double price; I need to insert data into a table which generate with some period such as 02.01.2018 00:00 - 02.01.2019 00:00 with an interval of 5 minutes. I cannot cope with this task. Please help me and show the SQL code example. 1 Answer 1 Assuming you mean 02.01.2018 = 2 January, this could be a way: select date '2018-01-02' + interval '5' minute * (level -1) from dual connect by date '2018-01-02' + interval '5' minute * (level -1) <= date '2019-01-02' By clicking "Post Your Answer", you acknowledge that you have read our updated ...