TO_CHAR Function for dates in UTF8 database

Hi,
Our database is UTF8 enabled infact we are using AL32UTF8 encoding. When we are running the following query then the results are displayed in Japanese instead of English for the 'DAY' and 'DY' clause.
SELECT TO_CHAR(SYSDATE,'DAY') DAY,TO_CHAR(SYSDATE,'YEAR') YR,TO_CHAR(SYSDATE,'DY') DY,TO_CHAR(SYSDATE,'MON') MON FROM DUAL;
DAY YEAR DY MON
火曜日 TWO THOUSAND SIX 火 JAN
Can anyone please tell me what is the reason behind this. Our other nls parameters are like;-
SQL> sho parameter nls
NAME TYPE VALUE
nls_calendar string
nls_comp string
nls_currency string
nls_date_format string
nls_date_language string
nls_dual_currency string
nls_iso_currency string
nls_language string AMERICAN
nls_length_semantics string BYTE
nls_nchar_conv_excp string FALSE
nls_numeric_characters string
nls_sort string
nls_territory string AMERICA
nls_time_format string
nls_time_tz_format string
nls_timestamp_format string
nls_timestamp_tz_format string
Thanks & Regards,
Sudipta

The date literals I used are in the
ISO standard for date notation of YYYY-MM-DD so are internationally unambiguous.  The only circumstance I can envisage in which it would not return the rows expected would be the extremely unlikely one where all the rows with dates in the range happen
to have a date of 7 March 2015, and all have a non-zero time of day element.  There is no such thing in Access as a date value, only a date/time value so #2015-03-07# in fact represents the point of time at midnight at the start of 7 March 2015. 
Any rows with date/time values of that date, but with a non-zero time of day would consequently fall outside the range.
The above is so unlikely that I can't believe it to be the case, but the bullet-proof syntax would be:
    strCondition = "dtAllocation  >= #2015-02-06# " & _
          "AND dtAllocation < #2015-03-07#+1"
i.e. all date/time values on or later than the start of the first day of the range (#2015-02-06 00:00:00#) and before the start of the day following the end of the range (#2015-03-08 00:00:00#)
Assuming that the dtAllocation column is of date/time data type, and is returned as such in the report's RecordSource, not as a formatted string expression, I can see no reason on the information available why the above should not work, so if the report is
still not returning any data some other reason not apparent to us must be suspected.  We are not in a position to debug the report, however, so what that might be I can't say.
Ken Sheridan, Stafford, England

Similar Messages

  • Math functions for dates

    Hello,
    Have you ever used a math function for dates (MMDDYYYY) not just a number? I'm looking to send an email out based on date field. For example, if someone's contract expires on 1/1/2016, I'd like to send them out emails 30, 152, 212 and 335 days before that date. Right now, we have fields set up for those 30, 152, 212 and 335 days and would like to know if there's a math function that would automatically fill them in dynamically based on their contract exp. date.
    Thanks for your help and suggestions.

    rmabrey wrote:
    I have the calculator working but I am having trouble figuring out thow to do a square root function, nth factorial, absolute value, and Fibonacci. java.lang.Math.sqrt()
    nothing for factorial - write your own.
    java.lang.Math.abs()
    nothing for Fibonacci - write your own.
    %

  • Functions for date datatype

    Dear ALL...
    Someone know some function for query months, years, days from date columns....???
    Example for MSSQL...select datepart(date collumn) from table....select month(date column) from table....etc
    I´m studing Oracle alone to get a OCP (OCA first)......the bad thing...I Work with the MSSQL.. (to me, Oracle is the best RDBMS)...
    Thks
    Daniel

    Hi Daniel,
    Well I saw that you come from Brazil and as you are studying Oracle by yourself, take a look on my blog http://mportes.blogspot.com - There you're going to find a lot of technical stuff in Portuguese. For intance you might interest on this
    http://mportes.blogspot.com/2005/11/trabalhando-com-intervalos-de-datas.html
    About your question, you can start with
    SQL> select to_char(sysdate, 'Mon') from dual;
    TO_
    May
    1 row selected.
    SQL> select to_char(sysdate, 'Month') from dual;
    TO_CHAR(S
    May
    1 row selected.
    SQL> select to_char(sysdate, 'Month', 'nls_date_language=portuguese') from dual;
    TO_CHAR(S
    Maio
    1 row selected.To find more information, I suggest you stop by
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/functions180.htm#SQLRF06129
    and try out http://tahiti.oracle.com there you will find all docs from Oracle (free).
    And so on...

  • TRUNC function for DATE

    Another thread from today made me think of the basics of TRUNC function used for DATEs. I am confused about what it acutally does.
    This is what Oracle Documenations says about TRUNC function without format (like 'DD-MON-YY')
    "If you omit fmt, then date is truncated to the nearest day" (Oracle 10Gr2 SQL reference, B14200-02)
    SQL> alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';
    Session altered.
    Query 1.
    SQL> SELECT SYSDATE FROM DUAL;
    SYSDATE
    06-DEC-2007 14:22:01
    Query 2.
    SQL> SELECT TRUNC(SYSDATE) FROM DUAL;
    TRUNC(SYSDATE)
    06-DEC-2007 00:00:00I have three questions
    1)Since it 2:22 pm , shouldn't the result of TRUNC(SYSDATE) ie Query 2. be 7-Dec-2007 ?
    2) What difference does TRUNC function make in the code apart from setting the time to 00:00:00?
    3) Is it safer to add TRUNC for DATEs in the code?
    SQL> select sysdate-1 from dual;
    SYSDATE-1
    05-DEC-2007 14:27:51
    SQL> select trunc(sysdate) - 1 from dual;
    TRUNC(SYSDATE)-1
    05-DEC-2007 00:00:00Added third question
    Message was edited by:
    user609308

    it's not a function that rounds up date's it purely truncates to the granularity that you want.
    So TRUNC(sysdate) still returns a date datatype (which still contains a date and time portion) but the time portion is truncated i.e. cleared down to it's lowest limit.
    Likewise if you TRUNC(sysdate,'YYYY') then it will truncate to the year and take months, days, hours, mins and secs down to their lowest limit hence giving you 1st January of that year with 00:00:00 as the time.
    It's very simple really.

  • Function for dates

    Hi Experts!
    i want to calculate months b/w 2 dates , is there function for this . can i find days and year  also .plz tell me .
    thanks.

    HAI TRY THIS
    REPORT  ZSAN_SDN2.
    SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME.
    PARAMETER:
              N1 TYPE T,
              N2 TYPE T.
    DATA:     DN1 TYPE T,
              DN2 TYPE T,
              DN3 TYPE I,
              DN4 TYPE I,
              DN6 TYPE I,
              DN5 TYPE I.
    SELECTION-SCREEN:
    BEGIN OF LINE,
    PUSHBUTTON 2(10) BUT1 USER-COMMAND CALC,
    PUSHBUTTON 13(10) BUT2 USER-COMMAND EXIT,
    END OF LINE.
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION-SCREEN.
      CASE SY-UCOMM.
        WHEN 'CALC'.
          MOVE: N1 TO DN1,
                N2 TO DN2.
          DN3 = DN2 - DN1 .
          DN3 = DN3 MOD 86400.
          DN4 = DN3 / 3600 .
          DN6 = DN3 / 60 .
          DN5 = DN6 MOD 60.
          DN3 = DN3 MOD 3600 .
          DN3 = DN3 MOD 60 .
          LEAVE TO LIST-PROCESSING.
          SET PF-STATUS SPACE.
          WRITE: / DN4, 'hours'.
          WRITE: / DN5, 'minutes'.
          WRITE: / DN3, 'seconds'.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    INITIALIZATION.
      BUT1 = 'calc'.
      BUT2 = 'exit'.

  • Between function for dates in Docmd.OpenReport rptName,,[date-filed] BETWEEN #date1# AND #date2# .. NOT WORKING

    Please assist, this is a nightmare indeed.
    Am trying to filter records in a report using the BETWEEN function, as below:
    strCondition = "Format([tblOrderLineTrack_main].[dtAllocation],'dd/MM/yyyy') BETWEEN Format(#06/02/2015#,'dd/MM/yyyy') AND Format(#07/03/2015#,'dd/MM/yyyy')" 
    DoCmd.OpenReport strDocName, acViewPreview, , strCondition, acWindowNormal
    The report is bringing up all records including those outside the specified range. What could be wrong with this???? Please assist, I am going nuts over this...

    The date literals I used are in the
    ISO standard for date notation of YYYY-MM-DD so are internationally unambiguous.  The only circumstance I can envisage in which it would not return the rows expected would be the extremely unlikely one where all the rows with dates in the range happen
    to have a date of 7 March 2015, and all have a non-zero time of day element.  There is no such thing in Access as a date value, only a date/time value so #2015-03-07# in fact represents the point of time at midnight at the start of 7 March 2015. 
    Any rows with date/time values of that date, but with a non-zero time of day would consequently fall outside the range.
    The above is so unlikely that I can't believe it to be the case, but the bullet-proof syntax would be:
        strCondition = "dtAllocation  >= #2015-02-06# " & _
              "AND dtAllocation < #2015-03-07#+1"
    i.e. all date/time values on or later than the start of the first day of the range (#2015-02-06 00:00:00#) and before the start of the day following the end of the range (#2015-03-08 00:00:00#)
    Assuming that the dtAllocation column is of date/time data type, and is returned as such in the report's RecordSource, not as a formatted string expression, I can see no reason on the information available why the above should not work, so if the report is
    still not returning any data some other reason not apparent to us must be suspected.  We are not in a position to debug the report, however, so what that might be I can't say.
    Ken Sheridan, Stafford, England

  • Help Required ---  TO_CHAR function for formatting DATE

    Tue, 20 Jan 2004 17:39:11 GMT.
    I want the output in the above mentioned format . Can any one help me ,Please.
    I tried some thing like this.......
    select to_char(sysdate,'Dy, DD Mon yyyy HH24:MI:SS') from dual; and them Append GMT to it. Is this correct the way ? :D.

    You can append the results of the following (assuming the database timezone is GMT):
    select dbtimezone from dual;

  • Search for data within a database table

    Hi everyone :)
    I'm trying to make it so that the user can search for a record by id #. So, i made an input dialogue thing so the user can enter a record #. Basically, i want the data to appear in their textboxes based on the record # inputted by the user. My attempt is shown below, and when I run it, I get this:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    Here's my code:
    public JButton getSearch()
              if (search==null)
                   search = new JButton("Search Database");
                   search.addActionListener
                        new ActionListener()
                             public void actionPerformed(ActionEvent ae)
                                  try
                                       String str_rec =
                                            JOptionPane.showInputDialog(
                                                 getFrame(),"Enter Record No");
                                       int recNo = 0;
                                       try
                                            recNo =
                                                 Integer.parseInt(str_rec);
                                       catch (NumberFormatException nfe)
                                            return;
                                       String select = "SELECT studId,studFirstName,studLastName " +
                                       "FROM Students " +
                                       "WHERE studId = '" + recNo + "' ";
                                       Statement statement = getConnector().getConnection().createStatement();
                                       ResultSet result = statement.executeQuery(select);
                                       System.out.println(recNo);
                                       getView().getId().setText(str_rec);
                                       getView().getFirstName().setText(result.getString("studFirstName"));
                                       getView().getLastName().setText(result.getString("studLastName"));
                                  catch (Exception e)
                                       e.printStackTrace();
              return search;
         }I hope I explained everything properly. If you could please help me, I'd very much appreciate it.
    Thanks in advance! :)
    - spidey

    "WHERE studId = '" + recNo + "' ";Why are you putting quote marks around a number? What type of database column is studId? Probably a numeric type (not character), right? Quotes go around string/character stuff, not numeric stuff.

  • How to use min-max functions for date in transformation in bpel?

    Hi,
    I have a requirement where i need to map earliest date of a Source field among all the dates to a target field in a transformation file in BPEL. There are functions called max-value-among-nodeset and min-value-among-nodeset in mathematical functions but they can be used only for numbers and strings.How to do these with dates?
    Thanks,
    Prasanna

    I exactly have the same requirement.Are you able to solve this?
    Its very urgent.Please help me.

  • How to use function for 'date' - 30 mins?

    Hi,
    I need to subtract 30 mins from date-time and display value in report?
    Any function?
    Thanks!
    Edited by: user12427117 on Mar 11, 2011 10:20 AM

    Date should be in canonical format
    i.e. YYYY-MM-DDThh:mm:ss+HH:MM
    or atleast YYYY-MM-DD
    when you want to divide you should have it as '1 div 48' and not 1/48
    Havent tried this one. So cant confirm if it works for mins

  • Function for Date Validation

    Hi,
    Can anyone tell me a Function Module to Valdate Date?
    Thanks & Regards
    Sheela

    Thanks for the Quick response.
    But i want a FM which will validate Every Date entered(Date format)
    Thanks Once again
    Regards
    Sheela

  • User response function() for Date Prompt

    Hi Experts,
    I have the requirement to show the date enterted in the prompt in the column of the webi report.
    I used the User response function e.g. =(UserResponse("Report Date").
    Now I am getting the value as 5/14/2014 12:00:00 AM. I dont want to see the time stamp with the date and aslo i want to change the format of the
    date to - yymmdd like 140514.
    Please provide your inputs.
    Thanks,
    Abhimanyu Sharma.

    Hi Arjit,
    I closed the thread.
    Can you please help in the below issue :
    I have two columns in the BEX report:
    1. "Local Count" which is restricted with Multiple Single Value variable "ZIN_CITY" on navigational Attribue 0ROUTE__0ROUTEID.
    2. "Out Count " which is restricted with Multiple Single Value variable "ZOUT_CITY" on navigational Attribue 0ROUTE__0ROUTEID.
    I put value 100 in prompt ZIN_CITY and 200 in ZOUT_CITY when i run this query in BOBJ WEbi.
    But i am getting the error - Not able to retrieve data. i checked in the backend and data is present and also Bex query is working fine.
    IF i change the property of variable to Single value then it is working fine in WEBi.
    Also i tried another method - irresprctive of setting the prompt in BEx on Nav attr 0ROUTE__0ROUTEID, i created the prompt in BOBJ WEBi, but LOVs (list of values)are not coming in the prompt.
    Please suggest on this?

  • Is there any in-built function for date compare?

    I need function which compare dates?

    Hi,
    You can simply use > , <,etc.,
    Check this sample code.
    data : d1 type RM06B-EEIND ,
           d2 type sy-datum.
    d1 = sy-datum.
           CALL FUNCTION 'DATE_IN_FUTURE'
             EXPORTING
               anzahl_tage                   = '-7'
               import_datum                  =  d1
            IMPORTING
              EXPORT_DATUM_EXT_FORMAT       =  d2
              EXPORT_DATUM_INT_FORMAT       =  d2
    if d1 < d2.
    write 'h'.
    endif.

  • NWEngine function for date

    Is there a list of nwengine functions anywhere?  I take it to be a VBscript capable, but there's no guide on how to get it to do simple things like date and time in any of the sample scripts.  It is unable to resolve the %date% and %time% variables,
    NwEngine.Variables.ResolveString("%date%")
    yet it resolves other variable successfully,
    NwEngine.Variables.ResolveString("%windir%\saplogon.ini")
    NwEngine.Variables.ResolveString("%username%")
    What gives?

    Dim MyTime
    MyTime = CStr(Time)   ' Return current system time.
    Dim MyDate
    MyDate = CStr(Date)   ' MyDate contains the current system date.

  • Using translate for date in the control file !!

    Hi,
    I am having data file where in i expect date but get non-numeric character.
    I am generating control file dynamically (programatically).
    While creating control file i know that here the type of data will be date so i put datatype as date. But at one place i got non numeric character instead of date.
    Now i want to put somekind of logic built in my dynamic generation which will check whether if value within that column is character then make it null and then load data. And if it is numeric keep it as it it.
    i.e.
    if(non-numericChars)
    make value null before loading.
    else
    keep the value as it and then load it.
    I heard that with translate function we can do that. Right ?
    So if i have a line like this in my control file:
    column_Name date "MM/DD/YYYY HH:MI:SS AM"
    How should i write the above statement to put the above mentioned logic.
    Any help would be highly appreciated.
    Regards,
    Dipesh

    and Perhaps TO_DATE can help you :
    TO_DATE
    Syntax
    to_date::=
    Text description of to_date
    Purpose
    TO_DATE converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to a value of DATE datatype. The fmt is a date format specifying the format of char. If you omit fmt, then char must be in the default date format. If fmt is 'J', for Julian, then char must be an integer.
    Note:
    This function does not convert data to any of the other datetime datatypes. For information on other datetime conversions, please refer to TO_TIMESTAMP, TO_TIMESTAMP_TZ, TO_DSINTERVAL, and "TO_YMINTERVAL".
    The default date format is determined implicitly by the NLS_TERRITORY initialization parameter, or can be set explicitly by the NLS_DATE_FORMAT parameter.
    The 'nlsparam' has the same purpose in this function as in the TO_CHAR function for date conversion.
    Do not use the TO_DATE function with a DATE value for the char argument. The first two digits of the returned DATE value can differ from the original char, depending on fmt or the default date format.
    Note:
    This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion. Please refer to "Datatype Comparison Rules" for more information.
    See Also:
    "Date Format Models"
    Examples
    The following example converts a character string into a date:
    SELECT TO_DATE(
    'January 15, 1989, 11:00 A.M.',
    'Month dd, YYYY, HH:MI A.M.',
    'NLS_DATE_LANGUAGE = American')
    FROM DUAL;
    TO_DATE('
    15-JAN-89
    The value returned reflects the default date format if the NLS_TERRITORY parameter is set to 'AMERICA'. Different NLS_TERRITORY values result in different default date formats:
    ALTER SESSION SET NLS_TERRITORY = 'KOREAN';
    SELECT TO_DATE(
    'January 15, 1989, 11:00 A.M.',
    'Month dd, YYYY, HH:MI A.M.',
    'NLS_DATE_LANGUAGE = American')
    FROM DUAL;
    TO_DATE(
    89/01/15
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions137a.htm#SQLRF06132
    Joel P�rez

Maybe you are looking for