Max value for a TIMESTAMP column?

What is the max value for a TIMESTAMP column?
I'm using the ODP.NET provider 9.2.0.4. When i put C#'s DateTime.MaxValue (i.e. 12/31/9999 23:59:59,999) into a TIMESTAMP column, everything is ok. Retrieving this value (e.g. via SQL*Plus Worksheet) returns ora-01877 (string too long for internal buffer).
Any ideas?
Regards,
Daniel

Maybe you hit Bug 1782816 Select of TIMESTAMP gives ORA-1877 on some platforms
Product (Component)                      : SQL*Plus (SQL*Plus)
Range of versions believed to be affected: Versions >= 9.0 but < 9.2 
Versions confirmed as being affected     : 9.0.1.3
Platforms affected                       : Generic (all / most platforms affected)

Similar Messages

  • How to assign default values for a timestamp column in a table?

    Hi
    Thank you for reading my post
    how i can make a column in a table to be autofilled with current timestamp ?
    for example when i create a table i want its timestamp field to be autofilled with current time stamp whenever a record generated.
    Thanks

    TEST@db102 SQL> create table test(a number primary key, b timestamp default systimestamp);
    Table created.
    TEST@db102 SQL> insert into test(a) values(1);
    1 row created.
    TEST@db102 SQL> select * from test;
             A B
             1 03-SEP-06 05.56.34.995319 PM
    TEST@db102 SQL>                                                            

  • Problem fetching multiple values in a TIMESTAMP column

    Hi all,
    I'm having a problem trying to fetch multiple values in a TIMESTAMP column. I can successfully fetch the TIMESTAMP column if I do the following:
    OCIDateTime tstmpltz = (OCIDateTime )NULL;
    rc = OCIDescriptorAlloc(p_env,(dvoid **)&tstmpltz, OCI_DTYPE_TIMESTAMP,
    0, (dvoid **)0);
    rc = OCIDefineByPos(p_sql, &p_dfn, p_err, 1, &tstmpltz, sizeof(tstmpltz),
    SQLT_TIMESTAMP, 0, 0, 0, OCI_DEFAULT);
    This works fine. I can then do what I want with the OCIDateTime variable tstmpltz, like convert it to a text string, etc.
    But what I am trying to do is fetch many rows of data that could include a TIMESTAMP column. For character columns this is no problem. I simply allocate a buffer of the correct width and length and then do my OCIDefineByPos to point to the start and the character data gets filled in. Same for numeric columns as well.
    I can do this with a TIMESTAMP column if I do the OCIDefineByPos with a column type of SQLT_CHR. But the problem I'm running into when I do things this way is if I fetch a Timestamp value that is before 1950 I believe it is, I get back the wrong century. So for instance 1900 comes back as 2000. I think this is because the default date format when fetching is a 2 digit year. So I've tried to the do following:
    long fetchrows = 50;
    unsigned char *descpp1;
    descpp1 = (unsigned char *)calloc(fetchrows, sizeof (OCIDateTime *));
    int i;
    for (i = 0; i != fetchrows; i++)
    /* Allocate descriptors */
    rc = OCIDescriptorAlloc((void *)p_env,(void **)&descpp1[i * sizeof (OCIDateTime *)], OCI_DTYPE_TIMESTAMP,
    0,(void **)0);
    // Bind the column
    rc = OCIDefineByPos(p_sql, &p_dfn, p_err, 1, descpp1, sizeof(descpp1),
    SQLT_TIMESTAMP, 0, 0, 0, OCI_DEFAULT);
    rc = OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 50, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL,
    OCI_DEFAULT);
    And I get an "ORA-01403: no data found" error. I'm missing something here but I can't figure out what it is. Is this proper way to fetch multiple Timestamp columns ?
    Thanks,
    Nick

    Hi Nick,
    I think the "trick" here is that when you call OCIDescriptorAlloc normally you would pass a pointer to an OCIDateTime pointer (i.e. OCIDateTime**). However, you're being sneaky here and using unsigned char * with malloc/calloc for the reasons you have already mentioned. So, that changes things a bit because in this scenario the "destination address" where OCI is going to put the address for the OCIDateTime descriptor is in the memory you have dynamically allocated rather than in the target pointer of an OCIDateTime** declaration. So far so good, but the problem, as you've discovered, comes about when you need to get the OCIDateTime* to pass into the OCIDateTimeToText function. In your call you have this:
    (OCIDateTime *)descpp1[0 * sizeof (OCIDateTime *)]However, that isn't the address of the descriptor it's a pointer to the address so, depending on your actual calls, etc. you'll either get a memory violation or an invalid OCI handle error. What you can do is get the address from that memory location and stuff it into a proper OCIDateTime* and then it can be used in the OCIDateTimeToText function.
    I'm probably doing a terrible job explaining it, but I have cobbled together a sample which does what you want (at least as far as I can tell). Of course, being OCI, there's a fair bit of code, but here's the main parts.
    I created a table called "ts_test" that has the following structure and sample data:
    SQL> desc ts_test
    Name             Null?    Type
    TS_ID                     NUMBER
    TS_VALUE                  TIMESTAMP(3)
    SQL> select * from ts_test order by ts_id;
         TS_ID TS_VALUE
             1 01-JAN-09 08.00.00.123 AM
             2 01-JAN-09 12.34.56.789 PM
             3 01-JAN-09 04.46.00.046 PM
             4 01-JAN-09 10.00.00.314 PM
    4 rows selected.I use the same query as above in the OCI sample code to get the values back out of the table.
      ** will hold pointers to TimeStamp Descriptor memory
      unsigned char *pTSD = (unsigned char *) NULL;
      ** temp pointer used with descriptors
      OCIDateTime *pTemp = NULL;
      ** allocate memory for the ts_id column
      if ((pID_val = (ub4 *) malloc(sizeof(ub4) * arrsize)) == NULL)
        printf("Failed to allocate memory for pID_val!\n");
        return;
      ** allocate memory for the ts descriptors
      if ((pTSD = (unsigned char *) malloc(sizeof(unsigned char *) * arrsize)) == NULL)
        printf("Failed to allocate memory for pTSD!\n");
        return;
      ** allocate date time descriptors
      for (i = 0; i < arrsize; i++)
        rc = OCIDescriptorAlloc(pDBCtx->envhp,
                                (void **) &pTSD[i * sizeof(OCIDateTime *)],
                                (ub4) OCI_DTYPE_TIMESTAMP,
                                (size_t) 0,
                                (void **) 0);
      ** define the first column in the results
      rc = OCIDefineByPos(stmtp,
                          &defnp,
                          pDBCtx->errhp,
                          (ub4) 1,
                          (void *) pID_val,
                          (sword) sizeof(ub4),
                          (ub2) SQLT_INT,
                          (void *) pID_ind,
                          (ub2 *) 0,
                          (ub2 *) 0,
                          (ub4) OCI_DEFAULT);
      ** define the second column in the results
      rc = OCIDefineByPos(stmtp,
                          &defnp,
                          pDBCtx->errhp,
                          (ub4) 2,
                          (void *) &pTSD[0],
                          (sword) sizeof(OCIDateTime *),
                          (ub2) SQLT_TIMESTAMP,
                          (void *) pTS_ind,
                          (ub2 *) 0,
                          (ub2 *) 0,
                          (ub4) OCI_DEFAULT);
      ** execute the statement
      rc = OCIStmtExecute(pDBCtx->svchp,
                          stmtp,
                          pDBCtx->errhp,
                          (ub4) arrsize,
                          (ub4) 0,
                          (CONST OCISnapshot *) NULL,
                          (OCISnapshot *) NULL,
                          (ub4) OCI_DEFAULT);
      ** get the text value of the timestamp
      ** null-terminate it, and display the value.
      ** the address of the allocated descriptor
      ** is copied from the dynamically allocated
      ** memory to the temp variable and that
      ** is passed to OCIDateTimeToText
      for (i = 0; i < arrsize; i++)
        memcpy((void *) &pTemp, &pTSD[i * sizeof(OCIDateTime *)], sizeof(OCIDateTime *));
        rc = OCIDateTimeToText((void *) pDBCtx->usrhp,
                               pDBCtx->errhp,
                               pTemp,
                               (oratext *) 0,
                               (ub1) 0,
                               (ub1) 3,
                               (oratext *) 0,
                               (size_t) 0,
                               &buflen,
                               buf);
        buf[buflen] = '\0';
        printf("Timestamp value[%d]: %s\n", *pID_val++, buf);
    ...Obviously there's lots left out, but hopefully that can be of some help. I've not really thoroughly reviewed the code so there may be a few things to fix. Anyway, using the above table and data the full sample outputs this on my system:
    Timestamp value[1]: 01-JAN-09 08.00.00.123 AM
    Timestamp value[2]: 01-JAN-09 12.34.56.789 PM
    Timestamp value[3]: 01-JAN-09 04.46.00.046 PM
    Timestamp value[4]: 01-JAN-09 10.00.00.314 PM
    ENTER to continue...Thanks,
    Mark

  • How to set physical min/max values for a scale in xy graph?

    Hello,
    I have troubles with the way LabView handles physical units in xy graphs. In particular, I use a time scale for the x axis.
    The values are timestamps and have the unit [s]. Now I want to read write the min max values for this scale via
    property nodes. It seems that the properties for min max do not support the use of the unit I use for the data for
    that same axis. This is very inconvenient and I am not even sure which kind of data to use at all for this properties.
    Is it simply converting to/from [s] using the unit converter?
    (I am using LabView 7.1 for the programm in question).
    Thanks,
    Olaf

    Hi Olaf
    "It seems that the properties for min max do not support the use of the unit I use for the data for that same axis."  
    What are the units you are using? can you make it a littlebit clear.
    You can change the units also using Property node.
    Just check the attachment once. If that is what you are looking for, then the problem is solved.
    Regards
    Anil
    Message Edited by reddy on 05-23-2006 05:25 AM
    Message Edited by reddy on 05-23-2006 05:27 AM
    Attachments:
    X-Scale.jpg ‏8 KB

  • Encountering Error in webadi : "&Value is invalid. Enter a valid value for the Mapping column &Column"

    We are having a custom WebADI, containing a field (Employee Name) which is a LOV.
    The LOV has ID : Person ID, Meaning : Employee name, Description : Position Name.
    There are multiple records with same Employee name but different Person ID.
    If I select an Employee in the LOV which has multiple records (through different IDs), I am getting an error in WebADI:
    "Enter a valid EMPLOYEE_NAME.
    XX is invalid. Enter a valid value for the Mapping column EMPLOYEE_NAME"
    The Query for the LOV is correct and is returning correct records.
    Any pointers on this issue highly appreciated.

    Hi,
    The problem could be with HR security profile attached to the responsibility from where you are launching the spreadsheet. Check it once.
    Thanks.

  • Max value for a varaible

    Hi ,
      I have a program with a variable used to store percentage , so let us assume ithas length 6 with 2 decimal places .
    What i would like to know is there some command or a FM which can give me the max value that can be stored in this varaible .  I do not want to write to much code or hardcode the value in the program .
    Regards
    Arun

    Hi Arun,
    Yo can use the FM 'MAXIMAL_VALUE_GET' for this.
    Eg: Here I wanto calculate the max value for variable 'max'
    DATA: max(5) TYPE p DECIMALS 3.
    CALL FUNCTION 'MAXIMAL_VALUE_GET'
         IMPORTING
              e_value = max.
    WRITE: / max.
    o/p: 999999,999
    Hope this helps you.
    Regards,
    Manoj Kumar P
    Edited by: Manoj Kumar on Jan 15, 2009 1:11 PM

  • Max.value for a sales order

    Hi Gurus,
    A min.order value can be maintained in Sales order by the condition type AMIW but can any one tell how to maintain max.value for a sales order???
    Awaiting your early answers..........
    Sunanda.P

    hi
    in OVA8, there maintain the maximum document value as required.
    If not then you need to take help of ABAPer
    With the help of ABAper you need to prepare a logic for this maximum order value.
    Then Go to sales order user exit userexit_save_document_prepare there u insert logic with the help of abaper.
    Based on logic created by ABAPer, while saving the sales order it will check this logic and throw out the error if it exceeds max value
    Regards
    Edited by: WISH on Aug 4, 2008 6:19 AM

  • Default values for files and columns when adding a discoverer porlet

    Hi, i'd like to know how to configure the default value for numbers of columns and files when i add a new discoverer porlet in a portal page.
    The actual default value is 10 files and 6 columns and i always have to increase it to at least 100x100.
    Is there any config file where i can change that?
    I've found a configuration.xml in $ORACLE_HOME/discoverer/config/configuration.xml
    with a section
    <!-- Discoverer Servlet configuration. Defines behaviour of both
    discoverer/plus and discoverer/viewer servlets -->
    but couldnt find a parameter for those items.
    Thanks in advance.
    Daniel Perez

    I think triggers are the best device.
    Scott

  • Need to concatonate multiple values for same key columns into one string

    Hi...I'm attempting to use PL/SQL to read through a table containing more than one column value for a set of keys, and concatonate those values together into one string. For example, in the STUDENT table, for a STUDENT_ID there are multiple MAJORS_ACCOMPLISHED such as History, Biology and Mathematics. Each of the majors is stored in a different row with the same STUDENT_ID due to different faculty DEPARTMENT values.
    I want to read through the table and write out a single row for the STUDENT_ID and
    concatonate the values for MAJORS_ACCOMPLISHED. The next row should be another STUDENT_ID and the MAJORS ACCOMPLISHED for that student..etc.
    I've hit a wall trying to use cursors and WHILE loops to get the results I want. I'm hoping someone may have run across this before and have a suggestion. Tks!!

    I think you are looking for string aggregation.
    The following are the replies posted by me in the forum recently on the same case.
    they might help you.
    Re: Concatenating multiple rows in a table - Very urgent - pls help
    Re: Doubt in a query ( Urgent )
    Re: How to remove words which consist of max 2 letters?
    Re: output like Name1,Name2,Name3...

  • How to take max value for this senario

    Hi,
    i have table xyz in which i have column display_code
    for eg.
    display_code in table like
    1. '1100000-999'
    2. '1100000-1000'
    3. '1100000-1001'
    now i have to take max value among 3 display code. my requirement when i take max it will give me '1100000-1001' or the next value
    select max(display_code) from xyz table;
    max(display_code)
    '1100000-999'
    Please help me to fetch max(display_code) = '1100000-1001'
    thanks & regard
    shyam~

    SQL> with xyz as (
      2  select '1100000-999' display_code from dual union
      3  select '1100000-1000' from dual union
      4  select '1100000-1001' from dual
      5  )
      6  --
      7  -- actual query:
      8  --
      9  select display_code
    10  from   xyz
    11  where  to_number(substr(display_code, instr(display_code, '-')+1)) =  ( select max(to_number(substr(display_code, instr(display_code, '-')+1)))
    12                                                                          from   xyz
    13                                                                        );
    DISPLAY_CODE
    1100000-1001or
    SQL> with xyz as (
      2  select '1100000-999' display_code from dual union
      3  select '1100000-1000' from dual union
      4  select '1100000-1001' from dual
      5  )
      6  --
      7  -- actual query
      8  --
      9  select display_code
    10  from   xyz
    11  where  to_number(replace(display_code, '-')) = ( select max(to_number(replace(display_code, '-')))
    12                                                                          from   xyz
    13                                                                        );
    DISPLAY_CODE
    1100000-1001Edited by: hoek on Sep 7, 2010 5:20 PM

  • Trigger how to get new and old value for nested table column?

    Hi,
    I have created a nested table based on the following details:
    CREATE TYPE typ_item AS OBJECT --create object
    (prodid NUMBER(5),
    price NUMBER(7,2) )
    CREATE TYPE typ_item_nst -- define nested table type
    AS TABLE OF typ_item
    CREATE TABLE pOrder ( -- create database table
    ordid NUMBER(5),
    supplier NUMBER(5),
    requester NUMBER(4),
    ordered DATE,
    items typ_item_nst)
    NESTED TABLE items STORE AS item_stor_tab
    INSERT INTO pOrder
    VALUES (800, 80, 8000, sysdate,
    typ_item_nst (typ_item (88, 888)));
    Now I would like to create a trigger on table pOrder for after insert or update or delete
    and I would like to track the new and old value for the columns inside nested table.
    Can anybody direct me how to do it?
    I would like to know the sytax for it like:
    declare
    x number;
    begin
    x := :new.nestedtablecolumn;--how to get the new and old value from nested table columns
    end;
    Hope my question is clear.
    Thanks,
    Lavan

    Hi,
    Try like this:
    CREATE OR REPLACE TRIGGER PORDER_I
    BEFORE INSERT
    ON PORDER
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    DECLARE
      items_new typ_item_nst;
      ordid_NEW NUMBER;
    BEGIN
    FOR i IN :new.items.FIRST .. :new.items.LAST LOOP -- For first to last element
      DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').prodid: ' || :new.items(I).prodid );
      DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').price:  ' || :new.items(I).price );
    END LOOP;
    END;Regards,
    Peter

  • Initialize the value for an identity column - HANA SPS8?

    Can initialize the value for the sequence (_SYS_SEQUENCE_) used for an identity column?
    Thank you

    Got it.
    There are two ways a sequence can be reset:
    alter sequence "UADMIN_USER"."_SYS_SEQUENCE_210253_#0_#" restart with 1
    During a restart of the database, the system automatically executes the RESET BY statement and the sequence value is restarted with the value determined from the RESET BY subquery.
    This sequence name I got from
    But I also got the following error message when trying the first approach:
    CREATE COLUMN TABLE TEST_TABLE (ID integer GENERATED BY DEFAULT AS IDENTITY(start with 2),COL2 VARCHAR(2));
    select '"' || SCHEMA_NAME || '"."' || SEQUENCE_NAME || '"' AS SEQUENCE_NAME from SEQUENCES WHERE RESET_BY_QUERY LIKE '%TEST_TABLE%';
    INSERT INTO TEST_TABLE(COL2) VALUES('r1');
    INSERT INTO TEST_TABLE(COL2) VALUES('r2');
    alter sequence "UADMIN_USER"."_SYS_SEQUENCE_210253_#0_#" restart with 1
    Could not execute 'alter sequence "UADMIN_USER"."_SYS_SEQUENCE_210253_#0_#" restart with 1' in 259 ms 481 µs .
    SAP DBTech JDBC: [383] (at 29): invalid identifier: _sys_ prefix not allowed: _SYS_SEQUENCE_210253_#0_#: line 1 col 30 (at pos 29)
    Let me know if you find something better.
    Regards,
    Pablo Silva

  • Query to get row with max values for distinct

    I have a table test with ID, ADID, MTMST columns.
    ID     ----ADID----     MTMST
    1     ----100----     24-MAR-12 08.17.09.000000 PM
    1     ----101----     24-MAR-12 08.18.15.000000 PM
    1     ----102----     24-MAR-12 08.18.56.000000 PM
    2     ----103----     24-MAR-12 08.19.21.000000 PM
    2     ----104----     24-MAR-12 08.19.36.000000 PM
    2     ----105----     24-MAR-12 08.19.46.000000 PM
    3     ----99----      22-MAR-12 09.48.22.000000 PM
    I need the rows with max ADID for each ID.
    I used the following query but it provided max ADID of the table but not the distinct ID
    select * from test where ADID in (select max(ADID) from test where id in (select distinct(id) from test where mtmst > sysdate -1))
    Result:*
    ID     ----ADID----     MTMST
    2     ----105----     24-MAR-12 08.19.46.000000 PM
    Expected result:*
    ID     ----ADID----     MTMST
    1     ----102----     24-MAR-12 08.18.56.000000 PM
    2     ----105----     24-MAR-12 08.19.46.000000 PM
    Thanks,
    Dheepan
    Edited by: Dheepan on Mar 24, 2012 9:53 AM

    select id, adid, mtmst from test where (id, adid) in (select id, max(adid) from test group by id) and MTMST>sysdate-1
    is the answer.

  • The max value for a key in an ODS

    hi,
    i want to link 2 ODS (Historic PRICE and PRICE)
    the key fields in Historic price ODS are : "material", "vendor" , and a field name "AVN"
    I want to create a start routine in order to find the data with the maximum value for the field "AVN" among data with the same key "material, vendor"
    Once this value found, i want to send it in the ODS : "PRIX"
    But how can i do it ?
    should i sort the ODS table ? what is the Abap fonction ?
    Than you very much for your help.
    Jacques

    Hi,
    seems that you need an extraction via self defined function-module.
    Within the FM, you can determine the max value like this:
    DATA: itab_ods_hist type standard table of /BIC/A<ODS HISTORIC PRICE>00 with header line.
    SELECT * FROM /BIC/A<ODS HISTORIC PRICE>00 INTO CORRESPONDING FIELDS OF TABLE itab_ods_hist
    SORT itab_ods_hist descending by material vendor AVN.
    DELETE ADJACENT DUPLICATES FORM itab_ods_hist COMPARING material vendor.
    This will give you only the max values within the itab.
    now hand this over.
    Example for a function module for extraction can be found in the R/3 source system.
    hth
    cheers
    sven

  • Sun One Web Server 6.1 max value for ChunkedRequestBufferSize

    Hi,
    I was wondering if there was a maximum value for ChunkedRequestBufferSize.
    I have an application that is sending chunked data to the server and I don't really know what the size of the chunks will be.
    I'd like to set a max.
    I know the default is 8K.
    Just wondering if there is a value. Though common sense would tell me it would depend on the heap size :).
    Thanks for your help

    Yes, the buffer is allocated from the heap. It must be less than 2GB and small enough to fit on the heap.

Maybe you are looking for

  • Is there a way to place a photo/graphic inside a text box with text?

    Have a nasty pricelist to do, 200+ pages. Listings top to bottom, lines everywhere. I've figured out a workflow that would make my life 1000 times easier if I can do like I can do in a DIV on a website, put a photo (in this case an Illustrator file)

  • Bug in PDF pinch and zoom?

    Hi, I have a big problem related the PDF pinch and zoom. When I try to make an article with 2 vertical pages each containing one imported PDF and 1 horizontal page contain two imported PDF, the result is a simple jpeg page with no pinch and zoom. The

  • Ready Set (Go!) Mission Query

    Hi, After the recent changes in Mission and Badges, I went to look after my Mission list. Then I found this, I had already bookmarked the document but this mission is still shown as Incomplete. I hope this is the document SCN Reputation Program Overv

  • Loading ipod downloads into new computer

    I have a new computer and want all my existing podcasts, music, photos, videos uploaded onto my new itunes account for this computer. How do I do that?

  • Validation Query: Modify Resource Name

    I have a validation check on one of my attributes in a entity object. When the error message is thrown it includes the attribute name at the front of the message error. Is there any way to modify that? I don't want the user seeing the name of the att