Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7904851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:15:37+00:00 2026-06-03T10:15:37+00:00

I have a question, how to parse datetime value from Oracle to MySQL database.

  • 0

I have a question, how to parse datetime value from Oracle to MySQL database.

I wrote this to extract a datetime from Oracle:

SELECT TO_CHAR(p1.creation_date,'DD.MM.RRRR HH24:mi:ss') AS dat_pot 
FROM TABLE

then I put the result into data set, then I extract the value of date from dataset like this:

string lDat_otp = null;        

if (rw_mat["dat_otp"].ToString().Length <= 0)
{
   lDat_otp = "0";
}
else
{
   lDat_otp = "convert(datetime,'" + rw_mat["dat_otp"] + "',4)";
}

Then I use lDat_otp in INSERT statement with some other values like this:

myQuery = " INSERT INTO ordersstavke (BrDok, " +
          " SifParFil, SifParIsp, DatPriOtpr, SifPodKla, Masa, Paketa) " +
          " VALUES ('" + rw_mat["brdok"] + "', '" +
                         rw_mat["sifskl_kor"] + "','" +
                         rw_mat["partner"] + "'," +
                         lDat_otp + ",'" +
                         rw_det["ibrmat"] + "', '" +
                         rw_det["izlaz_tez"] + "', '" +
                         rw_det["izlaz_kol"] + "')";

But there is an error on execute and it goes:

You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ‘26.01.2012 13:48:41′,4)’,’100654′, ‘0’, ’10’)’ at line 1

So help!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:15:39+00:00Added an answer on June 3, 2026 at 10:15 am

    You can parse the datetime field into a DateTime struct and then create an insert into query with parameters and pass the date as parameter :

    DateTime time = //Some value ...
    String myQuery = " INSERT INTO ordersstavke (BrDok, " +
              " SifParFil, SifParIsp, DatPriOtpr, SifPodKla, Masa, Paketa) " +
              " VALUES ('" + rw_mat["brdok"] + "', '" +
                             rw_mat["sifskl_kor"] + "','" +
                             rw_mat["partner"] + "'," +
                             "?date ,'" +
                             rw_det["ibrmat"] + "', '" +
                             rw_det["izlaz_tez"] + "', '" +
                             rw_det["izlaz_kol"] + "')";
    MysqlCommand command = new MysqlCommand(query, connection);
    command.Parameters.AddWithValue("?date", time);
    

    Doing this you should not have problems with date formatting.
    I strongly suggest to use parameters instead of string concatenation even for the others parameters of the query …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question in parsing XML. How can I parse out the value
New to Python, have a simple, situational question: Trying to use BeautifulSoup to parse
I need to parse the actual date value from a config file. So I
I have a simple question about DateTime in c#. I have a textbox where
I have datetime in one simple textbox. The format of the textbox's value can
I have a question or actually two regarding the Convert.ToInt32 function or Int32.Parse .
I have a question this time around regarding the Android custom camera, NOT the
I have a question. When some calls my webservice this is logged to the
I'm using Android, and I have a strange question: how can I parse JSON
This may be a basic C# question, but I'm comming from a C/C++ background.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.