Home » Open Source » Programming Interfaces » IST sysdate default is not working with Entity Framwork (Entity Framwork , DB 12c)
IST sysdate default is not working with Entity Framwork [message #666722] Tue, 21 November 2017 04:53 Go to next message
pradies
Messages: 250
Registered: May 2008
Senior Member
Hi,

We are using Entity framework with Oracle 12c as back-end. we have a table with following description. In table we have created_data column with default value in IST time zone sysdate conversion. when we are inserting records from application then created_date is getting insert same as system date(db server date/time)i.e. sysdate.

can someone please tell me how to get IST time when insert from entity framwork application.
CREATE TABLE RDE_VI
(
  BRANCH_ID        NUMBER(6)                    NOT NULL,
  INV_LOC_ID       NUMBER(6)                    NOT NULL,
  REPAIR_ORD_NBR   VARCHAR2(10 BYTE)                NULL,
  REMARKS1         VARCHAR2(500 BYTE)               NULL,
  REMARKS2         VARCHAR2(500 BYTE)               NULL,
  REMARKS3         VARCHAR2(500 BYTE)               NULL,
  REMARKS4         VARCHAR2(500 BYTE)               NULL,
  SCRAP_CODE       VARCHAR2(50 BYTE)                NULL,
  BER_CODE         VARCHAR2(150 BYTE)               NULL,
  PICTURE1         BLOB                             NULL,
  PICTURE2         BLOB                             NULL,
  PICTURE3         BLOB                             NULL,
  PICTURE4         BLOB                             NULL,
  VI_STATUS        VARCHAR2(5 BYTE)                 NULL,
  REPAIR_STATUS    VARCHAR2(20 CHAR)                NULL,
  VI_REASON        VARCHAR2(100 CHAR)               NULL,
  VI_BY            VARCHAR2(50 CHAR)                NULL,
  IS_DELETED       CHAR(1 BYTE)                 NOT NULL,
  CREATED_BY       VARCHAR2(30 BYTE)                NULL,
  CREATED_DATE     TIMESTAMP(6)                 DEFAULT systimestamp AT TIME ZONE 'Asia/Kolkata'     NULL,
  MODIFIED_BY      VARCHAR2(30 BYTE)                NULL,
  MODIFIED_DATE    DATE                             NULL,
  VI_STOCK_TYPE    VARCHAR2(4 CHAR)             DEFAULT 'NA'                  NOT NULL,
  IST_NEWDATETIME  TIMESTAMP(6)                 DEFAULT systimestamp AT TIME ZONE 'Asia/Kolkata'     NULL
);

When Trying to insert record from application below insert query is executing
INSERT INTO  "RDE_VI" ("BRANCH_ID",
                                    "INV_LOC_ID",
                                    "REPAIR_ORD_NBR",
                                    "REMARKS1",
                                    "REMARKS2",
                                    "REMARKS3",
                                    "REMARKS4",
                                    "SCRAP_CODE",
                                    "BER_CODE",
                                    "PICTURE1",
                                    "PICTURE2",
                                    "PICTURE3",
                                    "PICTURE4",
                                    "VI_STATUS",
                                    "REPAIR_STATUS",
                                    "VI_REASON",
                                    "VI_BY",
                                    "IS_DELETED",
                                    "CREATED_BY",
                                    "CREATED_DATE",
                                    "MODIFIED_BY",
                                    "MODIFIED_DATE",
                                    "VI_STOCK_TYPE",
                                    "IST_NEWDATETIME")
     VALUES ( :p0,
             :p1,
             NULL,
             :p2,
             :p3,
             :p4,
             :p5,
             :p6,
             NULL,
             NULL,
             NULL,
             NULL,
             NULL,
             :p7,
             :p8,
             :p9,
             :p10,
             :p11,
             :p12,
             NULL,
             NULL,
             NULL,
             :p13,
             NULL)


Thanks in Advance.

Re: IST sysdate default is not working with Entity Framwork [message #667780 is a reply to message #666722] Mon, 15 January 2018 07:49 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
1) TIMESTAMP datatype contain no TIMEZONE detail
2) SYSDATE contains no TIMEZONE detail.

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/nlspg/datetime-data-types-and-time-zone-support.html

Previous Topic: PHP insert or update nvarchar2
Next Topic: SQL query returning wrong values
Goto Forum:
  


Current Time: Sat Nov 23 03:26:54 CST 2024