Need help with date format mask

Hi there, right now I'm trying to set a default date format mask constraint for one of the attributes for my table. I want to set the default mask constraint as MM/DD/YY but I don't know how to. it should be something like:
CREATE TABLE work (WorkDate DATE CHECK (WorkDate = 'MM/DD/YY'))
or something like that, but I don't think that's correct. Can anyone help me? Thanks in advance.

What you want (and should have done) is to read the documentation, starting with the concepts:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#CNCPT413
http://www.oracle.com/pls/db102/search?remark=quick_search&word=date&tab_id=&format=ranked
A date is stored as, well, a date, format masks only come into play when you're selecting/retrieving a date or when you want to store a string as a date. Default date formats can be set through NLS_DATE_FORMAT at session and database level.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams122.htm#REFRN10119
Documentation homes (from which you can do a simple quick search):
http://www.oracle.com/pls/db102/homepage
http://www.oracle.com/pls/db112/homepage
Bottom line:
Trying to set a default date format mask on a date datatype column makes no sense...

Similar Messages

  • Need help with data formating.

    The following statment places extra spaces to the right of the month. I only want one space to the right of the month.
    How do I do that
    select to_char(to_date('08/07/2007','MM/DD/YYYY'),'MONTH DD, YYYY') || ' THRU ' || to_char(to_date('08/20/2007','MM/DD/YYYY'),'MONTH DD, YYYY') from
    dual
    What I get: AUGUST 07, 2007 THRU AUGUST 20, 2007
    What I want: AUGUST 07, 2007 THRU AUGUST 20, 2007
    Howard

    SQL> select
      2  to_char(to_date('08/07/2007','MM/DD/YYYY'),'MONTH DD, YYYY') ||
      3  ' THRU ' ||
      4  to_char(to_date('08/20/2007','MM/DD/YYYY'),'MONTH DD, YYYY') dt
      5  from dual
      6  union all
      7  select
      8  to_char(to_date('08/07/2007','MM/DD/YYYY'),'fmMONTH DD, YYYY') ||
      9  ' THRU ' ||
    10  to_char(to_date('08/20/2007','MM/DD/YYYY'),'fmMONTH DD, YYYY') dt
    11  from dual
    12  /
    DT
    AUGUST    07, 2007 THRU AUGUST    20, 2007
    AUGUST 7, 2007 THRU AUGUST 20, 2007Best regards
    Maxim

  • Need Help with Dates

    I am printing a calendar and certain events will be helds on certain dates.
    One can edit the event if it has not passed the date. Events in the past can be viewed but not edited.
    When I query the database the date must be formatted dd-MMM-yy
    I am able to get today's date by doing this:
    java.util.Date today = new java.util.Date();
    String formatString = "dd-MMM-yy";
    SimpleDateFormat sdf = new SimpleDateFormat(formatString);
    String today_str = sdf.format(today);
    My code for printing the calendar: I left out some of the table formatting in the JSP page.
    GregorianCalendar d = new GregorianCalendar();
    int today = d.get(Calendar.DAY_OF_MONTH);
    int month = d.get(Calendar.MONTH);
    d.set(Calendar.DAY_OF_MONTH,1);
    int weekday = d.get(Calendar.DAY_OF_WEEK);
    for(int i = Calendar.SUNDAY; i < weekday; i++)
    out.print("<td> </td>");
    do {
    int day = d.get(Calendar.DAY_OF_MONTH);
    out.print("<td>" + day + "</td>");
    String formatString = "dd-MMM-yy";
    SimpleDateFormat sdf = new SimpleDateFormat(formatString);
    //if(event exists on this day
    // Get results
    // print link for viewing
    // if (after today) print link for edit
    if(weekday == Calendar.SATURDAY)
    out.println("</tr><tr valign=top>");
    d.add(Calendar.DAY_OF_MONTH,1);
    weekday = d.get(Calendar.DAY_OF_WEEK);
    } while(d.get(Calendar.MONTH) == month);
    if(weekday != Calendar.SUNDAY)
    System.out.println();
    The part I need help on is this:
    //if(event exists on this day
    // Get results
    // print link for viewing
    // if (after today) print link for edit
    I'm looping through each day of the month to print the days. I have the month, day, year as integers. How can I create a date object out of that and compare it to today's date to test if it's before or after today???
    All the function in the Date class that I think would do this have been deprecated.

    Need Help with Dates
    Here is some information about dates:
    There are many edible palm fruits, and one of the most widespread and favored of these is the data (Phoenix dactylifera). Dates were cultivated in ancient land from Mesopotamia to prehistoric Egypt, possibly as early as 6000 B.C. Then--as now--dates were a staple for the natives of those dry regions. Much later, Arabs spread dates around northern Africa, and dates were introduced into California by the Spaniards in 1765, around Mission San Ignacio.
    The date prefers dry, hot climates, because date fruits are injured at temperatures of 20 degrees F, and the damp climate of the California coast was not favorable for fruit production. In the mid-1800s, the date industry developed in California's hot interior valleys and in Arizona. Now the date industry in the United States is localized mostly in the Coachella Valley, where the sandy soils permit the plants to be deeply irrigated. Today the new varieties, mostly introduced in this century, produce about 40 million pounds of dates per annum, or over 60% of the dates consumed in this country. The rest are imported mainly from Persia. According to one survey, about one million people are engaged entirely in date palm cultivation worldwide.
    Hope that helps.

  • Problem with date format mask 'D'

    I am experiencing an extremely thorny problem with the date format mask ‘D’. I am trying to use it to check whether today is a Monday. The variable v_temp_day is set to sysdate. For the last 4 weeks the code has behaved erratically – giving a different result at 02:00 than at 10:30 even though it is only taking account of the date. In desperation I inserted a debug statement formatting the date in a variety of ways – with interesting results. Oracle is somehow managing to tell us that today is simultaneously Monday and Tuesday depending on which format mask you choose. Anyone got any thoughts or suggestions?
    PROC_ID TO_CHAR(STAMP_TIM
    EVENT_SQLERRM
    RRHKP010 17092007 02:00:00
    TO_NUMBER( TO_CHAR( v_temp_day, D ) ) = 2. TO_CHAR( v_temp_day, D ) = 2. TO_CHAR( v_temp_day, DY ) = MON. TO_CHAR( v_temp_day, DAY )
    = MONDAY . TO_CHAR( v_temp_day, Day DD-MON-YYYY HH24MISS ) = Monday 17-SEP-2007 020000. TO_CHAR( v_temp_day, D ) = 2.
    SQL> select to_char( sysdate, 'D' ) from dual ;
    T
    1

    My book says the trunc(d,'iw') will return "same day of the week as Jan 1st of that year"It's bad book.
    Please read about [url http://oraclesvca2.oracle.com/docs/cd/B10501_01/server.920/a96540/functions176a.htm#80159]TRUNC & 'IW' Format Model and [url http://oraclesvca2.oracle.com/docs/cd/B10501_01/server.920/a96529/ch3.htm#50331]Database Globalization Support Guide: First Calendar Week of the Year in the manual.

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • Problem With Date Format Mask

    Hi everyone,
    when i set the date format mask in any field..
    if i enter any wrong date format messages are coming in to loop
    is this is bug of format mask?
    how can i avoid this..
    thanks in advance
    anand mohan

    It should not take you into a loop. If the "validation" against the format mask fails, a message is displayed, and the focus is returned to the field which caused the problem. Do you maybe have some method or event associated with the field which could be causing the circular behavior?
    -- Brian

  • Need help with date range searches for Table Sources in SES

    Hi all,
    I need help, please. I am trying to satisfy a Level 1 client requirement for the ability to search for records in crawled table sources by a date and/or date range. I have performed the following steps, and did not get accurate results from Advanced searching for date. Please help me understand what I am doing wrong, and/or if there is a way to define a date search attribute without creating a LOV for a date column. (My tables have 500,00 rows.)
    I am using SES 10.1.8.3 on Windows 32.
    My Oracle 10g Spatial Table is called REPORTS and this table has the following columns:
    TRACKNUM Varchar2
    TITLE Varchar2
    SUMMARY CLOB
    SYMBOLCODE Varchar2
    Timestamp Date
    OBSDATE Date
    GEOM SDO_GEOMETRY
    I set up the REPORTS table source in SES, using TRACKNUM as the Primary Key (unique and not null), and SUMMARY as the CONTENT Column. In the Table Column Mappings I defined TITLE as String and TITLE.
    Under Global Settings > Search Attributes I defined a new Search Attribute (type Date) called DATE OCCURRED (DD-MON-YY).
    Went back to REPORTS source previously defined and added a new Table Column Mapping - mapping OBSDATE to the newly defined DATE OCCURRED (DD-MON-YY) search attribute.
    I then modified the Schedule for the REPORTS source Crawler Policy to “Process All Documents”.
    Schedule crawls and indexes entire REPORTS table.
    In SES Advanced Search page, I enter my search keyword, select Specific Source Group as REPORTS, select All Match, and used the pick list to select the DATE OCCURRED (DD-MON-YY) Attribute Name, operator of Greater than equal, and entered the Value 01-JAN-07. Then the second attribute name of DATE_OCCURRED (DD-MON-YY), less than equals, 10-JAN-07.
    Search results gave me 38,000 documents, and the first 25 I looked at had dates NOT within the 01-JAN-07 / 10-JAN-07 range. (e.g. OBSDATE= 10-MAR-07, 22-SEP-07, 02-FEB-08, etc.)
    And, none of the results I opened had ANY dates within the SUMMARY CLOB…in case that’s what was being found in the search.
    Can someone help me figure out how to allow my client to search for specific dated records in a db table using a single column for the date? This is a major requirement and they are anxiously awaiting my solution.
    Thanks very much, in advance….

    raford,
    Thanks very much for your reply. However, from what I've read in the SES Admin Document is that (I think) the date format DD/MM/YYYY pertains only to searches on "file system" sources (e.g. Word, Excel, Powerpoint, PDF, etc.). We have 3 file system sources among our 25 total sources. The remaining 22 sources are all TABLE or DATABASE sources. The DBA here has done a great job getting the data standardized using the typical/default Oracle DATE type format in our TABLE sources (DD-MON-YY). Our tables have anywhere from 1500 rows to 2 million rows.
    I tested your theory that the dates we are entering are being changed to Strings behind the scenes and on the Advanced Page, searched for results using OBSDATE equals 01/02/2007 in an attempt to find data that I know for certain to be in the mapped OBSDATE table column as 01-FEB-07. My result set contained data that had an OBSDATE of 03-MAR-07 and none containing 01-FEB-07.
    Here is the big issue...in order for my client to fulfill his primary mission, one of the top 5 requirements is that he/she be able to find specific table rows that are contain a specific date or range of dates.
    thanks very much!

  • Pls Help with date format picture ends ......error

    Hi Everyone,
       I am getting the following error when I run my crystal report.
    Failed to retrieve data from the database.
    Details: HY000:[DataDirect][ODBC Oracle driver][Oracle]ORA-01830: date format picture ends before converting entire input string
    [Database Vendor Code: 1830]
       I am using SQL Command for my report and in the command  my date fields are of "Date" datatype.
       I am using Crystal Reports XI R2,driver - CR Oracle ODBC Driver 5.1
       Any help is greatly appreciated.
    Thanks in advance
    My SQL Command is as follows:
    <
    with MAXNEWSTAT as
    (select
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE,
    MAX(HRHISTORY.ACT_OBJ_ID) ACT_OBJ_ID
    FROM
    LAWSON.HRHISTORY
    WHERE
    HRHISTORY.FLD_NBR=20
    and TO_DATE(HRHISTORY.DATE_STAMP)
        >= TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,-1)),'YYYY/MM')||'/01'),'YYYY/MM/DD') 
        AND  TO_DATE(HRHISTORY.DATE_STAMP) <= (TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,0)),'YYYY/MM')||'/01'),'YYYY/MM/DD'))-1
    /--Added by HAN--/
        GROUP BY COMPANY,
        EMPLOYEE),
    NEWSTAT AS
    (SELECT
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE,
    HRHISTORY.A_VALUE,
    HRHISTORY.DATE_STAMP,
    HRHISTORY.BEG_DATE,
    HRHISTORY.ACT_OBJ_ID NS_OBJ_ID,
    HRHISTORY.SEQ_NBR
    FROM
    LAWSON.HRHISTORY
    INNER JOIN LAWSON.MAXNEWSTAT
    ON
    /--Added by HAN--/
    HRHISTORY.COMPANY = MAXNEWSTAT.COMPANY
    /--Added by KAM--/
    AND HRHISTORY.EMPLOYEE = MAXNEWSTAT.EMPLOYEE
    AND HRHISTORY.ACT_OBJ_ID = MAXNEWSTAT.ACT_OBJ_ID
    WHERE
    HRHISTORY.FLD_NBR=20
    and TO_DATE(HRHISTORY.DATE_STAMP)
        >= TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,-1)),'YYYY/MM')||'/01'),'YYYY/MM/DD') 
        AND  TO_DATE(HRHISTORY.DATE_STAMP) <= (TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,0)),'YYYY/MM')||'/01'),'YYYY/MM/DD'))-1
    PREVSTATID AS
    (SELECT
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE,
    MAX(HRHISTORY.ACT_OBJ_ID)OBJ_ID
    FROM
    LAWSON.HRHISTORY
        INNER JOIN LAWSON.NEWSTAT
    /--Added by HAN--/
        ON HRHISTORY.COMPANY = NEWSTAT.COMPANY
        AND HRHISTORY.EMPLOYEE = NEWSTAT.EMPLOYEE
    WHERE
    HRHISTORY.FLD_NBR=20
    AND TO_DATE(HRHISTORY.BEG_DATE)
    < to_date(NEWSTAT.BEG_DATE)
    GROUP BY
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE
    PREVSTAT AS
    (SELECT
    /--Added by HAN--/
    HRHISTORY.COMPANY,
    HRHISTORY.EMPLOYEE,
    HRHISTORY.A_VALUE A_VALUE,
    HRHISTORY.DATE_STAMP DATE_STAMP,
    HRHISTORY.BEG_DATE BEG_DATE,
    HRHISTORY.ACT_OBJ_ID OBJ_ID,
    HRHISTORY.SEQ_NBR SEQ_NBR
    FROM
    LAWSON.HRHISTORY
        INNER JOIN LAWSON.PREVSTATID
    /--Added by HAN--/
        ON HRHISTORY.COMPANY = PREVSTATID.COMPANY
        AND HRHISTORY.EMPLOYEE = PREVSTATID.EMPLOYEE
    WHERE
    HRHISTORY.FLD_NBR=20 AND
    HRHISTORY.ACT_OBJ_ID = PREVSTATID.OBJ_ID
    MAXPERSACTHST AS
    (SELECT
    PERSACTHST.EMPLOYEE,
    /--Added by KAM--/
    PERSACTHST.COMPANY,
    MAX(PERSACTHST.DATE_STAMP)DATE_STAMP
    FROM
    LAWSON.PERSACTHST
    WHERE
    (PERSACTHST.ACTION_CODE='LOASTATUS' OR PERSACTHST.ACTION_CODE='STATUS')
    AND TO_DATE(PERSACTHST.DATE_STAMP)
        >= TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,-1)),'YYYY/MM')||'/01'),'YYYY/MM/DD') 
        AND  TO_DATE(PERSACTHST.DATE_STAMP) <= (TO_DATE((TO_CHAR((ADD_MONTHS(SYSDATE,0)),'YYYY/MM')||'/01'),'YYYY/MM/DD'))-1
    GROUP BY PERSACTHST.EMPLOYEE,
    /--Added by KAM--/
    PERSACTHST.COMPANY
    CHANGELIST AS   
    (SELECT
    PERSACTHST.EMPLOYEE,
    /--Added by KAM--/
    PERSACTHST.COMPANY,
    PERSACTHST.ACTION_CODE,
    PERSACTHST.REASON_01,
    PERSACTHST.DATE_STAMP,
    PERSACTHST.EFFECT_DATE,
    PERSACTHST.REASON_02,
    PREVSTAT.A_VALUE PS_A_VALUE,
    PREVSTAT.DATE_STAMP PS_HR_DATE_STAMP,
    PREVSTAT.BEG_DATE PS_HR_BEG_DATE,
    PREVSTAT.OBJ_ID PS_HR_OBJ_ID,
    PREVSTAT.SEQ_NBR PS_HR_SEQ_ID,
    NEWSTAT.A_VALUE NS_A_VALUE,
    NEWSTAT.DATE_STAMP NS_DATE_STAMP,
    NEWSTAT.BEG_DATE NS_BEG_DATE,
    NEWSTAT.NS_OBJ_ID,
    NEWSTAT.SEQ_NBR NS_SEQ_NBR
    FROM
    LAWSON.PERSACTHST PERSACTHST
                        INNER JOIN LAWSON.PREVSTAT
                       ON PERSACTHST.EMPLOYEE=PREVSTAT.EMPLOYEE
                       /--Added by KAM--/
                       AND PERSACTHST.COMPANY = PREVSTAT.COMPANY
                       INNER JOIN LAWSON.NEWSTAT
                       ON PERSACTHST.EMPLOYEE = NEWSTAT.EMPLOYEE
                      /--Added by KAM--/
                       AND PERSACTHST.COMPANY = NEWSTAT.COMPANY
                       INNER JOIN LAWSON.MAXPERSACTHST
                       ON PERSACTHST.EMPLOYEE = MAXPERSACTHST.EMPLOYEE
                      /--Added by KAM--/
                         AND PERSACTHST.COMPANY = MAXPERSACTHST.COMPANY
    WHERE
    (PERSACTHST.ACTION_CODE='LOASTATUS' OR PERSACTHST.ACTION_CODE='STATUS')
    AND NEWSTAT.A_VALUE <> PREVSTAT.A_VALUE
    AND MAXPERSACTHST.DATE_STAMP = PERSACTHST.DATE_STAMP
    PAEMPPOSENDDATE AS
    (SELECT
      PAEMPPOS.EMPLOYEE,
      PAEMPPOS.COMPANY,
      CASE
      WHEN PAEMPPOS.END_DATE = TO_DATE('1700,01,01','YYYY,MM,DD')
             THEN to_date(SYSDATE + 1,'YYYY,MM,DD')
           ELSE PAEMPPOS.END_DATE 
      END END_DATE,
      PAEMPPOS.EFFECT_DATE
      FROM LAWSON.PAEMPPOS),
    CURRFTE AS
    (SELECT
      PAEMPPOS.EMPLOYEE,
    /--Added by KAM--/
      PAEMPPOS.COMPANY,
      PAEMPPOS.FTE CURR_FTE,
      PAEMPPOS.EFFECT_DATE,
      PAEMPPOSENDDATE.END_DATE  
    FROM
    LAWSON.PAEMPPOS
    INNER JOIN LAWSON.NEWSTAT
    ON (PAEMPPOS.EMPLOYEE = NEWSTAT.EMPLOYEE)
    /--Added by KAM--/
    AND (PAEMPPOS.COMPANY = NEWSTAT.COMPANY)
    INNER JOIN LAWSON.PAEMPPOSENDDATE
    ON PAEMPPOS.EMPLOYEE = PAEMPPOSENDDATE.EMPLOYEE
    /--Added by KAM--/
    AND PAEMPPOS.COMPANY = PAEMPPOSENDDATE.COMPANY
    AND PAEMPPOS.EFFECT_DATE=PAEMPPOSENDDATE.EFFECT_DATE
    WHERE
      (PAEMPPOSENDDATE.EFFECT_DATE <= NEWSTAT.BEG_DATE AND PAEMPPOSENDDATE.END_DATE >= NEWSTAT.BEG_DATE)
    PREVFTE AS
    (SELECT
      PAEMPPOS.EMPLOYEE,
    /--Added by KAM--/
      PAEMPPOS.COMPANY,
      PAEMPPOS.FTE PREV_FTE,
    PAEMPPOSENDDATE.END_DATE 
    FROM
    LAWSON.PAEMPPOS
    INNER JOIN LAWSON.NEWSTAT
    ON (PAEMPPOS.EMPLOYEE = NEWSTAT.EMPLOYEE)
    /--Added by KAM--/
    AND (PAEMPPOS.COMPANY = NEWSTAT.EMPLOYEE)
    INNER JOIN LAWSON.PAEMPPOSENDDATE
    ON (PAEMPPOS.EMPLOYEE = PAEMPPOSENDDATE.EMPLOYEE)
    /--Added by KAM--/
    AND (PAEMPPOS.COMPANY = PAEMPPOSENDDATE.COMPANY)
    AND (PAEMPPOS.EFFECT_DATE = PAEMPPOSENDDATE.EFFECT_DATE)
    WHERE
      PAEMPPOS.EFFECT_DATE <= (NEWSTAT.BEG_DATE-1)AND  PAEMPPOSENDDATE.END_DATE >= (NEWSTAT.BEG_DATE -1)
    SELECT DISTINCT
    EMPLOYEE.EMPLOYEE,
    EMPLOYEE.DEPARTMENT,
    EMPLOYEE.PROCESS_LEVEL,
    EMPLOYEE.EMP_STATUS,
    EMPLOYEE.FIRST_NAME,
    EMPLOYEE.LAST_NAME,
    EMPLOYEE.MIDDLE_INIT,
    EMPLOYEE.POSITION,
    PAPOSITION.DESCRIPTION,
    CHANGELIST.PS_A_VALUE,
    /--Added by KAM--/
    CHANGELIST.COMPANY,
    CHANGELIST.PS_HR_DATE_STAMP,
    CHANGELIST.PS_HR_BEG_DATE,
    CHANGELIST.PS_HR_OBJ_ID,
    CHANGELIST.NS_A_VALUE,
    CHANGELIST.NS_DATE_STAMP,
    CHANGELIST.NS_OBJ_ID,
    CHANGELIST.ACTION_CODE,
    CHANGELIST.REASON_01,
    CHANGELIST.REASON_02,
    CHANGELIST.DATE_STAMP PERSACTSDATESTAMP,
    CHANGELIST.EFFECT_DATE PERSACTEFFDATE,
    DEPTCODE.R_NAME DEPTNAME,
    PRSYSTEM.R_NAME PLNAME,
    PREVFTE.PREV_FTE,
    CURRFTE.CURR_FTE,
    CHANGELIST.NS_BEG_DATE,
    PGSELECT.GROUP_NAME,
    PAEMPLOYEE.SENIOR_DATE
    FROM
    LAWSON.CHANGELIST
                      INNER JOIN LAWSON.EMPLOYEE
                     ON (EMPLOYEE.EMPLOYEE = CHANGELIST.EMPLOYEE)
    /--Added by KAM--/
                     AND (EMPLOYEE.COMPANY = CHANGELIST.COMPANY)
                     INNER JOIN LAWSON.DEPTCODE
                     ON ((EMPLOYEE.COMPANY=DEPTCODE.COMPANY)
                     AND (EMPLOYEE.PROCESS_LEVEL=DEPTCODE.PROCESS_LEVEL)
                     AND (EMPLOYEE.DEPARTMENT=DEPTCODE.DEPARTMENT))
                     INNER JOIN LAWSON.PRSYSTEM
                     ON ((EMPLOYEE.COMPANY=PRSYSTEM.COMPANY)
                     AND(EMPLOYEE.PROCESS_LEVEL=PRSYSTEM.PROCESS_LEVEL))
                     LEFT OUTER JOIN LAWSON.PREVFTE
                       ON (CHANGELIST.EMPLOYEE=PREVFTE.EMPLOYEE)
    /--Added by KAM--/                
                     AND (CHANGELIST.COMPANY=PREVFTE.COMPANY)
                     LEFT OUTER JOIN LAWSON.CURRFTE
                     ON (CHANGELIST.EMPLOYEE=CURRFTE.EMPLOYEE)
    /--Added by KAM--/                                
                     AND (CHANGELIST.COMPANY=CURRFTE.COMPANY)
                     INNER JOIN LAWSON.PGSELECT PGSELECT
                       ON ((EMPLOYEE.COMPANY=PGSELECT.COMPANY)
                     AND (EMPLOYEE.EMP_STATUS=PGSELECT.BEGIN_VALUE))
                     LEFT OUTER JOIN LAWSON.PAPOSITION
                     ON (EMPLOYEE.POSITION=PAPOSITION.POSITION)
                     AND (EMPLOYEE.COMPANY=PAPOSITION.COMPANY)
                     INNER JOIN LAWSON.PAEMPLOYEE
                     ON (CHANGELIST.EMPLOYEE=PAEMPLOYEE.EMPLOYEE)
    /--Added by KAM--/               
                    AND (CHANGELIST.COMPANY=PAEMPLOYEE.COMPANY)
    WHERE
    (PGSELECT.GROUP_NAME='G:ACTIVE' OR PGSELECT.GROUP_NAME='G:INACTIVE')
    >

    Hi Arsh,
    The error message you receive i.e.
    ORA-01830: date format picture ends before converting entire input string
    is an Oracle error.
    The following document would be helpful:
    ORA-01830:     date format picture ends before converting entire input string
    Cause:     A valid date format picture included extra data. The first part of the format picture was converted into a valid date, but the remaining data was not required.
    Action:     Check the specifications for date format pictures and correct the statement.
    Regards,
    Alpana

  • Need help in date formatting

    Hi,
    I need to print date in the following format:
    Jan 21, 2007
    11:23 AM 21/01/2007
    21-01-2007 18:23
    Now as per condition of assignment the year, month, day and hour, min, sec all are entered as separate integer values.
    my code:
    import java.util.*;
    import java.text.*;
    public class stringToDate
    // Integer value of date and time variables
    int day=21;
    int month = 1;
    int year=07;
    int hour=18;
    int min=23;
    int sec=14;
    // Converting integer value into date
    public void convertIntoDate()
         String strTmp= day+"/"+month+"/"+year+" "+hour+":"+min+":"+sec;
         System.out.println("String: " + strTmp);
         DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
         try
              Date outDate = dateFormat.parse(strTmp);
              System.out.println("Converted: " + dateFormat.format(outDate));
         catch(Exception e){ System.out.println("Exception: " + e);}
    public static void main(String args[]) {
         stringToDate dF = new stringToDate();
         dF.convertIntoDate();
    }Now as per my code i am able to print in the following format:
    String: 21/1/7 18:23:14
    Converted: 21/01/0007 18:23:14
    But if i try to print in other formats it gives me following error message:
    Exception: java.text.ParseException: Unparseable date: "21/1/07"
    Please help me....

    vinee wrote:
    Hi,
    I tried different output format but still i'm facing the same issue
    Following the complete code and error message....
    import java.util.*;
    import java.text.*;
    public class stringToDate
    // Integer value of date and time variables
    int day=21;
    int month = 1;
    int year=07;
    int hour=18;
    int min=23;
    int sec=14;
    // Converting integer value into date
    public void convertIntoDate()
    DateFormat dateFormat;
    Date outDate=null;
    String strTmp= day+"/"+month+"/"+year+" "+hour+":"+min+":"+sec;
    System.out.println("Entered string for date: " + strTmp);
         // Format 01/01/0070 15:24:14
         dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
         try
         outDate = dateFormat.parse(strTmp);
         System.out.println("Converted into Date(dd/MM/yyyy HH:mm:ss): " + dateFormat.format(outDate));
         catch(Exception e){ System.out.println("Exception in format 1: " + e);}
         // Format Jan 21, 2007
         dateFormat = new SimpleDateFormat("EEE, MMM d, ''yyyy");
         try
         outDate = dateFormat.parse(strTmp);
         System.out.println("Converted into Date(EEE, MMM d, ''yyyy): " + dateFormat.format(outDate));
         catch(Exception fe)
         {System.out.println("Exception in format 2: " + fe);}
    public static void main(String args[]) {
              stringToDate dF = new stringToDate();
              dF.convertIntoDate();
    }Following is the error message:
    Entered string for date: 21/1/7 18:23:14
    Converted into Date(dd/MM/yyyy HH:mm:ss): 21/01/0007 18:23:14
    Exception in format 2: java.text.ParseException: Unparseable date: "21/1/7 18:23:14"
    Now as per the above error message format one is working fine but format 2(// Format Jan 21, 2007) have some issues...kind suggest.
    Edited by: vinee on Oct 2, 2008 4:23 AMPlease re-read my last reply.
    Once again : see [http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html]
    And your:
    int year=07; // should be:
    int year=2007;

  • Help with date format

    Hi, I have a record update form that shows Start date and End date in 2 separate fields like dd/mm/yyyy. When I edit the dates they do not get to the database correctly, all I get is 0000/00/00. I guess this is because the date format accepted by MySQL is yyyy/mm/dd.
    I'm stuck because I don't know how to convert the dates back to MySQL format for updating.
    This is the code that displays the start date:
    //<input name="AG_fechai" type="text" class="CP_loginFormFields" value="<?php echo date('d/m/Y',strtotime($row_eventosUpdate_RS['AG_fechai'])); ?>" size="32" />
    This is the code that displays the end date:
    //<input name="AG_fechaf" type="text" class="CP_loginFormFields" value="<?php echo date('d/m/Y',strtotime($row_eventosUpdate_RS['AG_fechaf'])); ?>" size="32" />
    This is my update query.(AG_fechai and AG_fechaf are the start and end date fields) which are not been updated. I appreciate your help. Thanks.
    // $updateSQL = sprintf("UPDATE t_agenda SET AG_fechai=%s, AG_fechaf=%s, AG_precio=%s, AG_horario=%s, AG_titulo_esp=%s, AG_titulo_eng=%s, AG_titulo_ger=%s, AG_titulo_fra=%s WHERE id_AG=%s",
    GetSQLValueString($_POST['AG_fechai'], "date",
    GetSQLValueString($_POST['AG_fechaf'], "date",
    GetSQLValueString($_POST['AG_precio'], "text",
    GetSQLValueString($_POST['AG_horario'], "text",
    GetSQLValueString($_POST['AG_titulo_esp'], "text",
    GetSQLValueString($_POST['AG_titulo_eng'], "text",
    GetSQLValueString($_POST['AG_titulo_ger'], "text",
    GetSQLValueString($_POST['AG_titulo_fra'], "text",
    GetSQLValueString($_POST['id_AG'], "int");
    mysql_select_db($database_amat_connect, $amat_connect);
    $Result1 = mysql_query($updateSQL, $amat_connect) or die(mysql_error());

    MySQL stores dates in one format only: the ISO recommended YYYY-MM-DD. You need to reorder the date parts to store the date correctly.
    If your input date is in the following format: dd/mm/yyyy, you can convert it by creating a custom function like this:
    function convertDate($val) {
      $parts = explode('/', $val);
      return "$parts[2]-$parts[1]-$parts[0]";
    Pass both dates to this function:
    GetSQLValueString(convertDate($_POST['AG_fechai']), "date",
    GetSQLValueString(convertDate($_POST['AG_fechaf']), "date",

  • Help with date formatting.

    Hi,
    I have been asked to fix a problem with a report. I have found that the problem is the date format being passed to the stored procedure is not correct, The current format is like Mon April 04 2007. The correct format should be DD-MMM-YYYY which I take to be Mon Apr 04 2004. I am not sure if this is correct anyway, but after looking at the code and the api I have managed to create a date object and call toString on it, after setting a simple date format to dd MMM yyyy.
    The problem is that the toString method returns Mon Apr 02 00:00:00 BST 20
    07. Is anybody able to help me with this? Below is a little bit of the code:
    public void renderDailyReport(ServletWriter out, HttpServletRequest request) throws Exception {
            // reset counters
            totalHits    = 0;
            maxHits      = 0;
            minHits      = 0;
            // get a GregorianCalendar object using the startDate and endDate Strings
            SimpleDateFormat  sdf         = new SimpleDateFormat("dd MMMM yyyy", Locale.UK);
            SimpleDateFormat procedureDateFormat = new SimpleDateFormat("dd MMM yyyy", Locale.UK);
            GregorianCalendar dateCounter = new GregorianCalendar();
            GregorianCalendar upperLimit  = new GregorianCalendar();
            sdf.setCalendar(Calendar.getInstance());
            Date sd = sdf.parse(startDate);
            Date ed = sdf.parse(endDate);
            procStartDate = procedureDateFormat.parse(startDate);
            procEndDate = procedureDateFormat.parse(endDate);The procStart and end dates are the bits that I added.
    They are passed to the stored procedure calling .toString, they are date objects.
    Appreciate any help.

    Do not use the toString() method of Date - it will always be the same format.
    Use the format() method of SimpleDateFormat.
    Date d = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("'dd-MMM-yyyy"); // or something like this
    String s = sdf.format(d);Message was edited by:
    jbish

  • Help with date format and sql

    Hi
    I am a complete oracle idiot.
    I have created a table with 2 columns po_id,po_date. Yhe id data type is number,date type is date. To add values to the table i enter something like
    "insert into purchase_orders(po_id,po_date) values(1,01/01/2004)"
    It does not accept the date and will not add the record, i have also tried the date format 01-Jan-2004.
    What is the proper way to add the date.
    Thanks
    Garry

    You probably want to use an explicit to_date cast. That lets you specify the format of the date string, i.e.
    INSERT INTO purchase_orders( po_id, po_date )
      VALUES( 1, to_date( '01/01/2004', 'DD/MM/YYYY' );Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Required help with date format

    Hi All,
    I am calling a webservice from plsql, for this I am using UTL_DBWS package. I want to insert the format of date as 'YYYY-MM-DD' only. I used to_char(sysdate, 'YYYY-MM-DD') , but it is throwing error. Please suggest any solution.
    Thanks and Regards,
    Mahesh
    The error details are as follows
    ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException
    Caught exception while handling request: invalid date: 25-NOV-08
    ORA-06512: at "SYS.UTL_DBWS", line 403
    ORA-06512: at "SYS.UTL_DBWS", line 400

    user6391695 wrote:
    Hi All,
    I am calling a webservice from plsql, for this I am using UTL_DBWS package. I want to insert the format of date as 'YYYY-MM-DD' only. I used to_char(sysdate, 'YYYY-MM-DD') , but it is throwing error. Please suggest any solution.What happens is...
    You convert sysdate into a string of the format YYYY-MM-DD and then you are passing that to a parameter that is a DATE datatype. When you do this oracle has to implicitly conver the string to the DATE datatype. It does this based on the NLS settings of the session which, I would guess, are not of the format YYYY-MM-DD, so it can't understand the string you have passed and fails to convert it to a date.
    Date formats are not something that is stored on the database (assuming you are correctly storing dates as DATE datatype). The format of dates is a display issue and something that should be handled by the user interface. The database stores data, just that, no display formats. ;)

  • Need help at date format while creating External Tables from Flat file

    Hi All,
    I have a flat file generated from SQL Server 2005. In that generated flat file the date format is in the format as "YYYY-MM-DD HH24:MI:SS.Millisec" like example "2007-09-08 13:32:36.568".
    My task is I have to load this flat file data into Oracle database table running on 9i, but its failing at the creation of external table itself because of this date format. The target table in Oracle the date column data type is "date" only not the "TIMESTAMP".
    Can any body suggest how to resolve this?
    Thanks,
    Sankar

    Or:
    SQL> select cast(to_timestamp('2007-09-08 13:32:36.568',
      2                  'yyyy-mm-dd hh24:mi:ss.xff') as  date) dt
      3  from dual;
    DT
    08-SEP-07                                                                                                                                                                                                                                                                                                                                                                   

  • Need help with date and time calculations please

    Hello there.. Im stuck, and im hoping someone can help..
    Working on a list to manage and track PTO.  User completes PTO request form,
    Fields
    Name
    Start Date (with time)
    End Date (with time)
    Total Number of Days/hours requested: (calculation)
    Full Day: (Yes/No)
    ok business need
    user has the ability to request a certain number of hours as opposed to a full day.
    After searching around on google. I found this calculation to help me figure out how many BUSINESS days being requested.
    =IF(ISERROR(DATEDIF([Start Date],[End Date],"d")),"",(DATEDIF([Start Date],[End Date],"d"))+1-INT(DATEDIF([Start Date],[End Date],"d")/7)*2-IF((WEEKDAY([End Date])-WEEKDAY([Start Date]))<0,2,0)-IF(OR(AND(WEEKDAY([End
    Date])=7,WEEKDAY([Start Date])=7),AND(WEEKDAY([End Date])=1,WEEKDAY([Start Date])=1)),1,0)-IF(AND(WEEKDAY([Start Date])=1,(WEEKDAY([End Date])-WEEKDAY([Start Date]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Date])=7),WEEKDAY([End Date])=7),1,0))
    This works great as long as its a [Full Day]="YES", displays results in column labeled Number of days
    now if [Full Day]="No", displays results in column labeled Number of Hours
    BUT this is my issue (well part of it) it calcuate the correct number of hours.. but puts a "1" in "Number of Days" why.. dates have not changed.. I think Its something with the above calculation but I could be way off.
    the end result is I need number of days to concat with number of hours 
    i.e 1 full day 4 hours  1.4
        0 full day 5 hours  0.5
        1 full day 0 hours  1.0
    so that the total can be deducted via workflow.. from the remaining balance in a tracker. (seperate list) 
    Any angels out there??

    Posnera-
    Try changing time zones and see if the travel itinerary times change.
    Fred

Maybe you are looking for

  • Envy 15t J000 Quad edition CTO BBV error?

    HI everyone! I just got a envy 15t, and decided that I'd rather replace the standard hard drive with a SSD. I created recovery media (wasted 2 disks that failed to complete), and was going through the process of booting the SSD from the recovery medi

  • How to generate an email on a database event?

    Dear gurus...I've heard about diferent ways of generating email in response to a database event e.g 1 - Using UTL_MAIL package or 2 - Event Driven Reporting feature of 10g Database and using SRW.Run_Report package to generate and mail a report. Now I

  • Table with two headers

    i have a designed a table with 2 headers(say H1 AND H2), and  dynamic body rows (with three columns) the issue is when the table is oveflowing in to next page only one of the header is showing on the next page, i have noticed that the option  " INCLU

  • Trouble with LR plug-in to Facebook

    Hi, I can't export from Zenfolio (using my LR plug-in) to my Facebook page.  It's enabled, etc.  Any advice?  The error message says: Information on album could not be retrieved from Facebook. Thanks!

  • How to install Flash Player in website

    My website is http://blog-expert-tips.blogspot.in/.