Retrieving/inserting timestamp

I have a VB dll that calls a stored procedure and retrieves a timestamp column (Oracle 9i, VB6, OraOLEDB Provider). I am getting the following error:ORA-06502: PL/SQL: numeric or value error: character string buffer too small
I am using the adDBTimeStamp type. Which is the correct ado type to use?
I also have direct "select * ..." sql statements that retrieve Timestamp data, and the application crashes when I try to execute them.
Has anyone encountered these issues. Are there any limitations on retrieving/inserting Timestamp data. Any help is appreciated.

Yes, I have had the same experience. When trying to create an OLE DB connection between Oracle 8.1.7 and SQL Server, I can see the schema and tables. When I try to query the linked Oracle server, if the table includes a timestamp field, I get unpredictable results or query crashes. If I try to use the timestamp field in a WHERE clause, I get an error saying that the timestamp data type cannot be converted to a datetime data type. I have tried explicit CAST or CONVERT statements, but they crash, too.

Similar Messages

  • Connecting to datasource and retrieve, insert and update data in SQL Server

    hi,
    i am trying to retrieve, insert and update data from SQL Server 2000 and display in JSPDynPage and is for Portal Application. I have already created datasource in visual composer. Is there any sample codes for mi to use it as reference???
    Thanks
    Regards,
    shixuan

    Hi,
    See this link
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6209b52e-0401-0010-6a9f-d40ec3a09424
    Regards,
    Senthil kumar K.

  • Connecting to datasource and retrieve, insert and update data

    hi,
    i am doing a JSP page that need to retrieve data and display on textView, insert data and update data. I have already create a datasource in Visual Composer. Does anyone have a sample codes for mi to use it as reference. So that i can connect to the datasource tat i created in Visual composer and retrieve, insert and update data. thanz
    Regards,
    shixuan

    Hi,
    After creating a data source in Visual composer .
    you have to create a BI system that Visual Composer can use in
    the SAP NetWeaver Portal.
    refer this pdf file for further Info
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6209b52e-0401-0010-6a9f-d40ec3a09424
    Regards,
    Beevin

  • Inserting Timestamp into a SQL database

    I am having a problem inserting a timestamp into a Sql Database. I keep getting this error or a different on when i format the timestamp differently. In the following code the timestamp is not formated at all.
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '13'
    this is the sql statement that is executed
    insert into timesheet(IDNUM,TimeIn,TimeOut,HoursWorked) values (123 , 2005-07-15 13:20:06.062 , 2005-07-15 13:20:06.062 ,0)
    the code is as follows:
         <%
         try
                SimpleDateFormat test = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
                Timestamp stamp = new Timestamp(System.currentTimeMillis());
                java.util.Date date = new java.util.Date();
                String sql = "insert into timesheet(IDNUM,TimeIn,TimeOut,HoursWorked) values (" + session.getAttribute("IDNum") + " , " + stamp + " , " + stamp + " ,0)";
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection cnxn = DriverManager.getConnection("jdbc:odbc:EmployeeSystem");
                Statement stmt = cnxn.createStatement();
                 stmt.execute(sql);
                response.sendRedirect("employee.jsp");
         catch(Exception dberr)
             SimpleDateFormat test = new SimpleDateFormat("yyyyMMddhhmm");
             Timestamp stamp = new Timestamp(System.currentTimeMillis());
             out.println(dberr);
             out.println("insert into timesheet(IDNUM,TimeIn,TimeOut,HoursWorked) values (" + session.getAttribute("IDNum") + " , " + stamp + " , " + stamp + " ,0)");
         %>please help.
    The reason that i need the timestamps in there is that i am creating a time clock program for my school that they can put on a intranet so thier hourly employees can use instead of the current manual system they use.

    even better would be to use prepared statements and set the fields via Timestamp objects.
    String sql = "insert into timesheet(IDNUM ,TimeIn ,TimeOut ,HoursWorked ) values (?,?,?,?)";
    Statement stmt = cnxn.prepareStatement(sql);
    int idNum = (Integer)session.getAttribute("IDNum").intValue();
    Timestamp stamp = new Timestamp(System.currentTimeMillis());
    stmt.setInt(1, idNum);
    stmt.setTimeStamp(2, stamp);
    stmt.setTimeStamp(3, stamp);
    stmt.setInt(4, 0);
    stmt.execute();It makes your code much more portable, as you don't have to worry about the database having a TO_DATE function with that syntax.
    Cheers,
    evnafets

  • Insert timestamp into a Date field.

    Hi anyone knows if I insert a timestamp into a date field, will it sort according to the date field if I use an sql statement to sort the data?

    Your question is quite unclear, it sounds like you have two questions:
    1. Can I insert a timestamp into a date field (in the database?)?
    2. Can I sort my sql statement using the date field?
    Is this what you are asking? If not, please clarify.

  • How to insert timestamp ?

    I have a table with column timestamp(6) .When I query the database the data is as follows
    select start_time from timetable;
    1/11/2007 2:52:35.231000 AM
    1/11/2007 2:51:21.747000 AM
    ...so on .
    I would like to insert the timestamp values into this. I can do this by saying insert into start_time values(SYSDATE) which works fine but if I say the following
    insert into start_time values ('1/11/2007 2:51:21.747000 AM') or
    insert into start_time values (timestamp'1/11/2007 2:51:21.747000 AM')
    I get an error
    ORA-01861 -literal does not match format string
    help is appreciated
    Roger

    > ORA-01861 -literal does not match format string
    An ugly run-time error. But is not all run-time errors just plain butt ugly..
    The real problem however is that most times such errors are caused by even uglier code.
    In the case of an ORA-01861, it is caused by code that uses implicit data type conversions. This is ugly. Explicit data type conversions should be used.
    Implicit means that you give one data type to Oracle (such as a string) when Oracle is expecting another data type (such as a timestamp). Oracle tries to accomodate you by converting the one data type to the other. The NLS (National Language Support) settings govern this data type conversion.
    However, a good client will set the NLS settings as per the client's national settings (see Control Panel in Windows where a user can choose his/her date and time and other formats).
    This means that the NLS settings will differ from client session to client session. Ugly code that use implicit data type conversions will therefore only work for some sessions. And cause run-time errors for other sessions.
    Good code will instead do explicit data type conversions.
    For example, instead of sending Oracle a string like '2007/01/11 09:06:00', the code will send Oracle a date as TO_DATE('2007/01/11 09:06:00','yyyy/mm/dd hh24:mi:ss').
    Make it a rule from now on when coding (in any language, any database) - use explicit data type conversions. Do not write "bad" code that is prone to run-time errors.

  • Inserting timestamps after set time

    I am pritty new to labVIEW and am wondering how to insert a timestamp after a set time (say 30minutes) after the temprature has risen above a set level (in this case 30C).
    Thanks
    Chaz

    Hi Chaz,
    Thanks for the post and I hope your well.
    If I understand the question correctly (which Im not sure I do), you want to generate a time stamp after a certain condition?
    If so, in the example below we time how long the loop has been running for. The trigger is the stop button. You could change this logic to produce a true when X amount of time had passed.
    However, when you say time stamp - I assume you mean you want to time stamp your data? Now normally in DAQmx the waveform data generated already contains time stamps. If your trying to build your own waveform have you tried using the Build Waveform Node?
    Or maybe your trying to do this?
    How Do I Include a Time Stamp in a File Using the Write To Measurement File.vi
    http://digital.ni.com/public.nsf/allkb/68806B93A21​355E98625726F0064822B?OpenDocument
    Please post back so we can help you some more,
    Hope this helps,
    Message Edited by Hillman on 12-04-2008 12:35 PM
    Message Edited by Hillman on 12-04-2008 12:38 PM
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!
    Attachments:
    Time Stamp.JPG ‏18 KB

  • Insert TimeStamp into Db2 using a date String

    I need help with inserting a timestamp into DB2.
    I get timestamp in the format of a string from a flatfile. e.g "19981012122345"
    I need to store this as a timestamp in DB2.
    im using the Preparedstatement.
    How do i convert this String into a Timestamp?
    im trying to insert that as a string and it doesnt work.
    This is holding up my work... any ideas, sample code appreciated.
    Thanks
    Sri

    Thanks citcru.
    I followed the same pattern as you showed.
    I needed timezone too. so i modified the code as below... hope someone else may need this. I refered in the forums for this example.
    int Year = Integer.parseInt(Time.substring(0,4));
    int Month = Integer.parseInt(Time.substring(4,6));
    int Day = Integer.parseInt(Time.substring(6,8));
    int Hour = Integer.parseInt(Time.substring(8,10));
    int Minutes = Integer.parseInt(Time.substring(10,12));
    int Seconds = Integer.parseInt(Time.substring(12));Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("CST"));
    calendar.set(Year,(Month-1),Day,Hour,Minutes,Seconds);
    Timestamp tstamp = new Timestamp(calendar.getTime().getTime());
    Thanks again citrcu for the reply, this helped me a lot.
    Sri

  • Inserting Timestamp INTO messages.

    I know how to view the timestamp on Messages on the iPhone. I know I can swipe and see that.
    I want to have a timestamp INCLUDED in my messages - so that people receiving messages from me see the time stamp of when I wrote the message, not when they received it.
    One friend (not an iPhone user) swears I send text messages at 4am, because that's when his phone decides to grab them from the ether. I need to have the actual messages timestamped with the time I'm writing them!

    No, there isn't.
    take a screen shot of the messages from from your phone and send to him.

  • URGENT HELP NEEDED FOR TimeStamp

    Urgent Millisecond Question....
    I have the Java Code which used to work well in Oracle 8 and Sybase ..
    When I am using it with Oracle 9.2 it creating a problem...
    The code is
    final public JDatetime getJDatetime(int columnIndex) throws SQLException {
         boolean convertb = Util.needConvertTime();
         Timestamp ts=_rs.getTimestamp(columnIndex);
         if(ts==null) return null;
         Date d= new Date(ts.getTime() + (ts.getNanos()/1000000));
         if(convertb) d = Util.ReferenceTZ2Local(d);
         return new JDatetime(d);
    Now in Oracle 8 Say when I insert a
    JDateTime Value as 2003-06-18 16:51:06.89
    and
    When I retrieve is using above getJDatetime
    it get retrieved as
    2003-06-18 16:51:06.0
    Which is ok since Milliseconds are lost....
    Now in Oracle 9
    When I use the convert
    Date d= new Date(ts.getTime() + (ts.getNanos()/1000000));
    It get converted to
    Original Value While Inserting -->TimeStamp in JResultSet->2003-06-18 18:15:56.42
    Date in JResultSet-->Wed Jun 18 18:15:56 GMT 2003
    Date in JResultSet after converting to ReferenceTZ
    Wed Jun 18 18:15:56 GMT 2003
    DateTime in JResultSet after converting to DateTime6/18/03 6:15:56.840 PM
    GMTGETDatetime 6/18/03 6:15:56.840 PM GMT
    so if you see
    Milliseconnd 42 got converted to 840 NanoSeconds
    WHICH IS WRONG
    Can anybody help me with it ??
    Mahesh

    The only Adobe program I know that can edit images is Photoshop.
    If you have troubles with Google software, you need to post in the appropriate Google forum.

  • Adding a timestamp field to a table (MySQL database)

    I've defined a field in a MySQL table as type 'timestamp'
    eg. 2010-05-25 21:36:19
    When I perform an insert using coldfusion, the row doesn't change the value in the timestamp automatically
    Am I better creating my own timestamp field, type varchar and manually insert my timestamp values ?

    No, it is a pretty bad idea to use a text field to store date-time information.  It makes it much harder to do date and|or time calculations on the data.
    A timestamp field does not mean you have a field that automatically inserts a timestamp on record insert and|or update.  Just that you have a field that expects a 'timestamp' value which is usually a date-time value down to the millisecond precision.
    You can set up the database to automatically create this value when data is inserted and|or updated, but that is more then just creating the timestamp field.  And the specifics will change depending on your exact database management system.  Searching the internets for information on your database managerment system of choice and auto and|or default values for fields should guide you in the correct direction.
    Or you can insert timestamp data along with the other data you are inputting into the database.  The now() function combined with the <cfqueryparam value="#timeData#" cfsqltype="cf_sql_timestamp"> is a useful combination to do this.

  • Converting sql timestamp into a usable java format??

    hi there.
    does anyone know how to convert an sql timestamp into a usable java format? i have retrieved a timestamp from a mysql table in a jsp script and would like to convert it into the following format:
    12:42pm | 08.07.02
    as i understand it, i'll need to convert the timestamp into seconds since 1970 and then manipulate it as a calendar object? my first line is working, but i don't know what to do after...
    java.sql.Timestamp sqlTimestamp = resultSet.getTimestamp("date_and_time");
    next...?
    any help would be much appreciated!!
    thanks.

    please excuse my java sytnax ignorance, but i've tried a bunch of different syntax arrangements and can't figure out how to use the getTime() method. what comes after my first line there?
    java.sql.Timestamp sqlTimestamp = resultSet.getTimestamp("date_and_time");
    then something like:
    long msec=date.getTime(sqlTimestamp);
    but that doesn't seem to work...
    thanks for any help!

  • As of version 31, why is there still no Thunderbird option to insert current date and time in message that you are writing?

    As of version 31, why is there still no Thunderbird option to QUICKLY insert current date and time in message that you are writing?
    Literally have seen this very-much-needed -- and used -- option "promised" for three years now, and even if there's only one or two formats that could be used, at least the option is there.
    It seems only way is to link a Macro and tool to Thunderbird and do it that way.
    Joe Rotello
    [email protected]
    Skype: joerotello

    Where was it promised? A quick search of Bugzilla didn't find a functionality request bug report for it.
    I assume you're aware that Mozilla stopped development about 2 years ago (just adds security/stability fixes and provides infrastructure) and all new features and bug fixes are now added by the community. They seem pretty tied up with bug fixes and reworking some hard to maintain components such as the MIME support.
    Have you tried the Timestamp add-on at https://addons.mozilla.org/en-us/thunderbird/addon/timestamp/ ? The version at AMO doesn't support versions later than 2.0 so you'd need to do something like install the disable add-on compatibility checks add-on at https://addons.mozilla.org/en-us/thunderbird/addon/checkcompatibility/?src=ss, and ignore the warning message about Timestamp not being compatible. However, the author has a version at http://extensions.sanjer.nl/?page=tb_ts that supposedly supports up to Thunderbird 11.9.x so it should be "compatible by default as it supports version 5 or later and is not a binary add-on like Lightning or Enigmail.
    "For Thunderbird use the context menu (right click popup) in the compose window, Ctrl+Shift+T or "Options | Insert timestamp" to inserts the date/time into a message"

  • Oracle Timestamp Issue

    I'm using a Oracle 9.2 database and Oracle 9 JDBC drivers.
    The server has its time zone set to GMT and I'm testing from a client in EST.
    It seems like the Timestamp are not being returned correctly.
    What I think is happening here is mismatch between the time zone of Oracle server and the client that is not being accounted for when the driver is creating timestamps.
    If I add the row using sysdate at 8 AM EST on a server running on GMT, then retrieve the timestamp with JDBC using a Java default time zone of EST, I get a timestamp that matches 1 PM EST or 6 PM GMT.
    If I retrieve it with JDBC after setting my Java default time zone to GMT (so it matches the server), then I get a timestamp that matches 8 AM EST or 1 PM GMT which is correct.
    My hunch is that the driver is just doing a new Calendar and setting the hour directly from the server. So if the server passes 1 PM (or hour 13 in 24 hour day), it just sets it using the default time zone whatever it is. As long as the client default time zone and the Oracle server time zone are the same, everything works fine. If they are different, there will be a discrepancy of the number hours offset between the time zone of the client and the time zone of the server.
    Does any one else have any ideas?

    First, I am not setting the timestamp without
    conversion (#2). The driver is setting the timestamp
    and you are suggesting exactly what I think the
    driver is doing.
    As I understand it, timestamp has NO timezone. It is,
    in fact, a long number of milliseconds since Jan 1,
    1970 GMT.
    Timezones come into play when we go to render the
    milliseconds in a way that makes sense ot humans.
    In other words, the timestamp for 8 AM EST and 1 PM
    GMT are the same. If you don't believe it, create two
    Calendar objects, one with EST timezone and the other
    with GMT. Set the GMT one to 1 PM and the other one
    to 8 AM (same day, year, minutes, and milliseconds).
    Then display the time as a long. It is the same value.Correct.

  • Find records based on their insertion order

    Hi to all,
    Is there any way I can find records based on their insertion order.
    Like i inserted 5 records, can I find fifth record based on that insertion order?
    Advance thanks for your inputs
    Regards
    Karthik

    Not without adding some kind of sequencing mechanism to your inserts.
    You could use sequence numbers, or for more robustness, insert timestamps alongside your inserts.
    Triggers will help you to acheive this.

Maybe you are looking for

  • How to get Hotmail on iPhone

    I want to know how can I get hotmail on my iphone

  • Radio button data to php form

    I set up a survey, and I need the info from the radio button groups to send to a php form that will email me the results. So far I have not been able to get it to work. All I have so far is the code below attached to the submit button. I had a workin

  • Use of Add in Sequence in payments

    Can someone please clarify the difference between "Add" and "Add in Sequence" for incoming/outgoing payments? Thank you.

  • Migo-return delivery-credit memo

    hello gurus i created po for 10 kg . then i made gr of 10 kg. now i am returning 5 kg . delivery document is created .but now look the sequence ii created po for 10 kg . then i made gr of 10 kg.now i posted miro for 10 kg of material. now i want to r

  • IPS Event Viewer

    Hi, I can't seem to be able to view informational events in IPS Event Viewer real time dashboard, they don't appear. Under the monitoring tab on the sensor i can see them no problem. If i change the signature alert to either low medium or high i get