Insert timestamp with timezone in database

조회 수: 11 (최근 30일)
Christian
Christian 2021년 7월 26일
댓글: Christian 2021년 7월 30일
Hi,
I'd like to insert (table) data into an Oracle database. The data contains datetime variables with timezone information which should be inserted into a oracle table with type timestamp with timezone.
sqlwrite (or similar) function can add/transform datetime to timestamp (oracle), but not to timestamp with timezone. The only workaround I've found is a direct linewise exec insert sql statement (insert into table () values ().... ) whereas datetime timezone is set to UTC and is formatted like
strcat('to_timestamp_tz(''', datestr(tbl.TS ,'dd.mm.yyyy HH:MM'), ' 00:00'', ''dd.mm.yyyy HH24:MI TZH:TZM'')')
Not very elegant and fast...
I'm using R19b.
Thanks for any hints...
Christian

채택된 답변

Shadaab Siddiqie
Shadaab Siddiqie 2021년 7월 30일
From my understanding you want to insert timestamp with time zone in database. Since this is some sort of custom format that you want inserted into your database from my understanding you must create a workaround it (as you have already done) and there might not be another elegant way to do it.
  댓글 수: 1
Christian
Christian 2021년 7월 30일
Thanks for the feedback. Yes, that's what I'd like to do.
I thought since timestamp with timezone a common data type in oracle there might be a common way to import these data. However, this seems to be a general issue (importing timezone information to oracle), since I ran into the same problem in other languages like Python...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by