Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a small query, I tried all possibilities but some how it is not working.

I am trying to Insert or Update timestamp with Timezone into Oracle table using VB.NET 2012. It keeps on giving me an error ORA-00900 Invalid SQL Statement. But when I use the same command to Insert/Update it works without any problem.

I have tried the following code I hope anyone might have any idea how to achieve this.

Thanks

What I have tried:

Dim Pyear As String = thisDate1.Year
Dim PMonth As String = thisDate1.Month
Dim PDate As String = thisDate1.Day
Dim PHour As String = thisDate1.Hour
Dim PMins As String = thisDate1.Minute
Dim pSec As String = thisDate1.Second
Dim pMilliSec As String = thisDate1.Millisecond
Dim ci As CultureInfo = CultureInfo.InvariantCulture
Dim thisDate2 As New DateTimeOffset(Pyear, PMonth, PDate, PHour, PMins, pSec, pMilliSec, TimeSpan.Zero)



Dim oradb As String = "Data Source=RPROODS;User Id=sys;Password=System32;DBA Privilege=SYSDBA"
Dim conn As New OracleConnection(oradb)
conn.Open()
Dim cmd2 As OracleCommand
Dim sqlLastEdit As String = "UPDATE INVN_SBS SET MODIFIED_DATE = to_timestamp_tz('" & thisDate2.ToString("dd-MMM-yy h.mm.ss tt +03:00") & "','DD-MON-RR HH.MI.SSXFF AM TZR') WHERE ITEM_SID=" & itemSID

cmd2 = New OracleCommand(sqlLastEdit, conn)
MessageBox.Show(sqlLastEdit)

cmd2.CommandText() = CommandType.Text

cmd2.ExecuteNonQuery()
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900