How oracle (10.1) decides when the week begins, ends?

Hello friends,

I'm bundling a week in my query.

The oracle instance is running on my computer: Red Hat Linux 5, the locale for starting oracle is provided below.

From my point of view, my week started on 31/01/2010 (Sunday) and ends at 2010-06-02 (Saturday).
Yet my oracle thinks differently: as can be seen in the example below, the 5th week begins on 29/01/2010 and ends on 02/05/2009.

Why is this behavior?
How can I control it, and how do I adjust for i18n?

Thank you
Maxim

[oracle@mldev2 ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
[oracle@mldev2 ~]$ file /etc/localtime
/etc/localtime: symbolic link to `/usr/share/zoneinfo/Israel'
SQL> select TO_CHAR(TO_DATE('28-JAN-2010'), 'WW YYYY') week from dual;
-------
04 2010

SQL> select TO_CHAR(TO_DATE('29-JAN-2010'), 'WW YYYY') week from dual;
-------
05 2010

SQL> select TO_CHAR(TO_DATE('30-JAN-2010'), 'WW YYYY') week from dual;
-------
05 2010

SQL> select TO_CHAR(TO_DATE('31-JAN-2010'), 'WW YYYY') week from dual;
-------
05 2010

SQL> select TO_CHAR(TO_DATE('01-FEB-2010'), 'WW YYYY') week from dual;
-------
05 2010

SQL> select TO_CHAR(TO_DATE('02-FEB-2010'), 'WW YYYY') week from dual;
-------
05 2010

SQL> select TO_CHAR(TO_DATE('03-FEB-2010'), 'WW YYYY') week from dual;
-------
05 2010

SQL> select TO_CHAR(TO_DATE('04-FEB-2010'), 'WW YYYY') week from dual;
-------
05 2010

SQL> select TO_CHAR(TO_DATE('05-FEB-2010'), 'WW YYYY') week from dual;
-------
06 2010

SQL> select TO_CHAR(TO_DATE('06-FEB-2010'), 'WW YYYY') week from dual;
-------
06 2010

SQL> select TO_CHAR(TO_DATE('07-FEB-2010'), 'WW YYYY') week from dual;
-------
06 2010

Hello

Beginning of the week is decided by NLS parameter's settings nls who decide NLS_TERRITORY.

If you want your week should begin with Sunday not to use "WW" (according to NLS_TERRITORY), instead use 'IW', it doesn't depend of parameter nls.

Concerning
Anurag.

Tags: Database

Similar Questions

  • How to add two lines when the second row is not visible, but also gets the first data line too?

    Mr President

    Jdev worm is 12.2.1

    How to add two lines when the second row is not visible, but also gets the first data line too?

    I want to add two lines like below picture, but want the second to remain invisible.

    tworows.png

    I asked this question but my way of asking was wrong, that's why for me once again.

    Concerning

    Try to follow these steps:

    1. in the database table to add the new column "JOIN_COLUMN" and add the new sequence "JOIN_SEQ".

    2. Add this new column in the entity object. (You can add this in entity object by right clicking on the entity object and then select "Synchronize with database" then the new column and press on sync)

    3. in your bookmark create button to create only one line NOT 2 rows.

    4 - Open the object entity--> java--> java class--> on the entity object class generate and Tick tick on the accessors and methods of data manipulation

    5 - Open the generated class to EntityImpl and go to the doDML method and write this code

      protected void doDML(int operation, TransactionEvent e)
      {
        if(operation == DML_INSERT)
        {
          SequenceImpl seq = new SequenceImpl("JOIN_SEQ", getDBTransaction());
          oracle.jbo.domain.Number seqValue = seq.getSequenceNumber();
          setJoinColumn(seqValue);
          insertSecondRowInDatabase(getAttribute1(), getAttribute2(), getAttribute3(), getJoinColumn());
        }
    
        if(operation == DML_UPDATE)
        {
          updateSecondRowInDatabase(getAttribute1(), getAttribute2(), getAttribute3(), getJoinColumn());
        }
    
        super.doDML(operation, e);
      }
    
      private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object joinColumn)
      {
        PreparedStatement stat = null;
        try
        {
          String sql = "Insert into table_name (COLUMN_1,COLUMN_2,COLUMN_3,JOIN_COLUMN, HIDDEN_COLUMN) values ('" + value1 + "','" + value2 + "','" + value3 + "','" + joinColumn + "', 1)";
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
      private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object joinColumn)
      {
        PreparedStatement stat = null;
        try
        {
          String sql = "update table_name set column_1='" + value1 + "', column_2='" + value2 + "', column_3='" + value3 + "' where JOIN_COLUMN='" + joinColumn + "'";
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
  • If time machine is incremental how it removes previous versions when the disk is full, without breaking the chain, so do not be able to restore all changes since the first full file

    If time machine is incremental how it removes previous versions when the disk is full, without breaking the chain, so do not be able to restore the file with any changes made since the full backup first file...

    If the TM drive storage is full TM automatically deletes the version the oldest files for the new incremental backups can be made. Thus, in this case you cannot restore the versions that TM deleted because it takes more storage.

  • How to solve a problem when the windows setup program does not open a program, says I need to install it. and an error message 1706

    How to solve a problem when the windows setup program does not open a program, says I need installation cd and a 1706 error message happens.

    Hi PAtwoodwu,

    1. what program are you trying to install?

    2. did you of recent changes on the computer?

    3 does happen with all programs?

    Check and make sure that the Windows service install is running on the computer.

    (a) click on start to reduce this includes this image, click run , type services.msc , and then press enter to open Services.

    (b) right click on the Windows Installer service and then click Properties.

    (c) if the box Startup type is set to Disabled, change it to Manual.

    (d) click on OK to close the Properties window.

    (e) right click on the Windows Installer service and then click Start. The service should start without errors.

    (f) click on the file menu, and then click exit.

  • How to add multiple lines when the button is clicked

    How to add multiple lines when the click on button now is just add a row .plz give me idea how... waiting for answer

    / public final class screen extends MyScreen
    {
    /**
    * Creates a new object of MyScreen
    */
    ObjectChoiceField obj1 obj2, obj3, obj4.
    Table of String() = {'101 ', ' 102'};
    String of shadow [] = {"Shade1", "Shade2"};
    Rolls of string [] = {'101 ', ' 102'};
    String cutting [] = {"100-150", "150-200"};
    Chain of selectedindex1, selectedindex2, selectedindex3, selectedindex4;
    LabelField lbl1 lbl2, lbl3, lbl4;
        
    GFM LinedGridFieldManager;
    HFM HorizontalFieldManager, hfm1, hfm2 hfm3;
    VerticalFieldManager vfmMain;
        
    public MyScreen()
    {
        
    Set the displayed title of the screen
    hfm1 = new HorizontalFieldManager (HorizontalFieldManager.NO_VERTICAL_SCROLL |) HorizontalFieldManager.NO_VERTICAL_SCROLLBAR);
    hfm2 = new HorizontalFieldManager (HorizontalFieldManager.NO_VERTICAL_SCROLL |) HorizontalFieldManager.NO_VERTICAL_SCROLLBAR);
    hfm3 = new HorizontalFieldManager (HorizontalFieldManager.NO_VERTICAL_SCROLL |) HorizontalFieldManager.NO_VERTICAL_SCROLLBAR);
    HFM = new HorizontalFieldManager (HorizontalFieldManager.FIELD_RIGHT);
    vfmMain = new VerticalFieldManager (Manager.NO_VERTICAL_SCROLL |) Manager.NO_HORIZONTAL_SCROLLBAR);
            
    obj1 = new ObjectChoiceField ("", graph, 0, FIELD_LEFT);
    obj2 = new ObjectChoiceField ("", blind, 0, FIELD_LEFT);
    Obj3 = new ObjectChoiceField ("", rolls, 0, FIELD_LEFT);
    Obj4 = new ObjectChoiceField ("", cuts, 0, FIELD_LEFT);
            
    LBL1 = new LabelField("");
    LBL2 = new LabelField("");
    lbl3 = new LabelField("");
    lbl4 = new LabelField("");
            
    ButtonField btnAdd = new ButtonField ("ADD", FIELD_RIGHT);
            
    GFM = new LinedGridFieldManager (4, LinedGridFieldManager.VERTICAL_SCROLL);
            
    hfm1.setMargin (20, 0, 10, 0);
    hfm1. Add (new LabelField ("Chart"));
    hfm1. Add (obj1);
    hfm1. Add (new LabelField ("Shade"));
    hfm1. Add (obj2);
            
    hfm2. Add (new LabelField ("Rolls"));
    hfm2. Add (Obj3);
    hfm2. Add (new LabelField ("Cuts"));
    hfm2. Add (Obj4);
    HFM. Add (btnAdd);
            
    GFM. Add (new LabelField ("Chart"));
    GFM. Add (new LabelField ("Shade"));
    GFM. Add (new LabelField ("Rolls"));
    GFM. Add (new LabelField ("Cuts"));
            
    vfmMain.add (hfm1);
    vfmMain.add (hfm2);
    vfmMain.add (hfm3);
    vfmMain.add (hfm);
    vfmMain.add (new SeparatorField());
    vfmMain.add (gfm);
    Add (vfmMain);
            
    btnAdd.setChangeListener (new FieldChangeListener()
    {
    ' Public Sub fieldChanged (field field, int context) {}
    TODO self-generating method stub
    selectedindex1 = chart [obj1.getSelectedIndex ()];
    selectedindex2 = shade [obj2.getSelectedIndex ()];
    selectedindex3 = rolls [obj3.getSelectedIndex ()];
    selectedindex4 = cuts [obj4.getSelectedIndex ()];
                    
    While (LBL1. GetText(). Equals("") | LBL2. GetText(). Equals("") | lbl3. GetText(). Equals("") | lbl4. GetText(). Equals(""))
    {
    LBL1. SetText (selectedindex1);
    LBL2. SetText (selectedindex2);
    lbl3. SetText (selectedindex3);
    lbl4. SetText (selectedindex4);
                    
    GFM. Add (LBL1);
    GFM. Add (LBL2);
    GFM. Add (lbl3);
    GFM. Add (lbl4);
                    
    }
    }
    });
    }
    }

    Hi Piya,

    I run your code, and according to your logic that it works correctly.

    It's adding that line only once because according to your logic that one line can be added to MDT, if you do not want to add line on each click on the button, follow these steps:

    selectedindex1 = chart [obj1.getSelectedIndex ()];
    selectedindex2 = shade [obj2.getSelectedIndex ()];
    selectedindex3 = rolls [obj3.getSelectedIndex ()];
    selectedindex4 = cuts [obj4.getSelectedIndex ()];

    Lbl1 LabelField = new LabelField("");
    Lbl2 LabelField = new LabelField("");
    LabelField lbl3 = new LabelField("");
    LabelField lbl4 = new LabelField("");
    If (LBL1. GetText(). Equals("") | LBL2. GetText(). Equals("") | lbl3. GetText(). Equals("") | lbl4. GetText(). Equals(""))
    {
    LBL1. SetText (selectedindex1);
    LBL2. SetText (selectedindex2);
    lbl3. SetText (selectedindex3);
    lbl4. SetText (selectedindex4);
                    
    GFM. Add (LBL1);
    GFM. Add (LBL2);
    GFM. Add (lbl3);
    GFM. Add (lbl4);
                    
    }

  • How to start a task when the other ends

    I want to run multiple scripts in the order (in Windows 7 Professional) and each have a tenure when the previous one ends. Is there a way to tell the Scheduler to do this? There are a variety of different types of (Korn Shell scripts running under Cygwin, R, BACK lot), and each of them produces results that are used in the following script. Different types of scripts, I don't think I can combine them into a single script.

    I do this every night, to develop a weather-based forecast for a hands-on experience. There are a lot of calculation and a time limited, and I do also simplified as possible, so I can't just schedule the scripts independently, separated far enough out so that they would never overlap. I couldn't get Cron to work in Cygwin, so I'm using the Windows Task Scheduler.  So far I can get all one script to run at any time I want, I just can't understand how to link the start one at the end of another.

    You can put several actions in any task to Task Scheduler.  You will use the trigger 'on an event"for what you need.

    The best advice on TS is Task Scheduler Overview - MSTechNet.

  • Oracle Text returns no results when the string begins with two consecutive vowels

    Hello

    I hope someone can shed some light on a strange problem, that we face.

    Oracle Database 11 g R2 (11.2.0.4) EE 64 bit running on Windows 2008 Server R2.

    When I create an index of context on a column varchar2 (surname), it works fine when the surname begins with a consonant or a vowel. But when the family name starts with two vowels, that it fails to return the file?

    Please see example below:

    create table t1 (surname varchar2(50));
    
    insert into t1 values ('OURS');
    insert into t1 values ('JOURS');
    insert into t1 values ('ONES');
    
    commit;
    
    -- sync every 10 mins
    CREATE INDEX PERSON_SURNAME_IDX ON t1
    (SURNAME)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('MEMORY 50M sync (every "SYSDATE+10/1440")')
    NOPARALLEL;
    
    -- no rows
    SELECT surname 
    FROM t1
    WHERE CONTAINS(surname, 'OURS') > 0;
    
    -- 1 row
    SELECT surname 
    FROM t1
    WHERE CONTAINS(surname, 'JOURS') > 0;
    
    -- 1 row
    SELECT surname 
    FROM t1
    WHERE CONTAINS(surname, 'ONES') > 0;
    

    Any help or advice greatly appreciated.

    Thank you

    Ours is in the list of default stoplist (list of words that are ignored)

    http://docs.Oracle.com/CD/B19306_01/text.102/b14218/astopsup.htm#CEGBGCDF

  • How to validate an entry when the focus leaves the intensity absorbed in

    How to validate an entry when the focus leaves the intensity absorbed in a form?

    "Ansury" wrote in message
    News:garo90$L71$1@forums. Macromedia.com...
    > Not AFAIK. Event.Target has a reference to the object that sent the
    > event. In livedocs:
    >
    > "Every event object has a goal and a currentTarget property that help."
    > you
    > Hold where it is being spread. The target
    > property
    "> return to the sender of the event.
    "
    >
    > BUT...
    > Your if statement will never evaluate true because you compare one
    > UITextField to a TextInput. A UITextField (stored internally in a
    (> TextInput, it makes the text) actually dispatches the event.

    currentTarget gives you the object on which the event actually listener
    attached to...

  • MacBook Pro opens to the screen and progress bar gray, freezes when the progress bar ends. Have tried several options to get into safe mode and suggested strikes, but can't. Any suggestions?

    MacBook Pro opens to the screen and progress bar gray, freezes when the progress bar ends. Have tried several options to get into safe mode and suggested strikes, but can't. Any suggestions?

    Here are some links from Apple which may help

    How to choose a boot on your Mac - Apple Support drive

    On the screens, you see when you start your Mac - Apple Support

  • How to stop going backwards when the user click on bar train ADF

    Hi all

    I use the Train of the Adf. and I would like to know how to get the following scenarios

    When the user click on step backwards train by train bar, I like to do validation and don't let go without validation.


    With respect,
    WP

    Hello

    ADF Code corner (http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html#CodeCornerSamples) will have a solution as sample 97. It will probably come out tomorrow

    Frank

  • How to control automatic shutdown when the battery is discharged using Windows

    The laptop stops right in the Middle something without notice.

    Even after that I formatted the system, he still stops automatically when the battery is low, without advising me of either the low battery status or the judgment.

    I don't think that the cause of the problem is the power management because it is set to balanced.

    How can I control when the pc stops?

    Hello

    Usually, you can change these settings within the Windows power management.
    Using Win 7 or Win 8/8.1?

    Here is the Nice technical document about the features of Windows 7 power management
    http://APS2.toshiba-tro.de/KB0/HTD12017W0001R01.htm

    Check the last option called: battery.
    It provides many useful features such as low battery, critical battery level, low battery action or critical battery action

  • How to change existing keywords when the site is not in the bookmarks bar?

    I've implemented several shortcuts keyword for sites that I use frequently. Now, how can I change the keywords or URLS when the site is not in the list of bookmarks? Is there a master file Firefox for these access which can be edited by the user? Or another way to get to them?

    Not sure if it's the same on Mac OS x, but it is how it is done under Windows and Linux versions of Firefox.

    Bookmarks > organize bookmarks

    Highlight the bookmark in the right pane, and then click more at the bottom to see the keywords and Description fields for this bookmark.

  • How to stop a beep when the loop ends

    Hello

    I have a beep occurs inside a loop (which contains waves of data acquisition) to a certain threshold. I want the sound system for not introducing any delay in the execution of the loop.

    But I also have another beep when the loop ends. How to eliminate this noise?

    Your comments will be greatly appreciated. Thank you

    PI

    The obvious answer would be: remove the beep VI this is probably. Please show us your code.

  • How to edit scanned documents when the output options are PDF files

    I have a printer of HP Photosmart Plus b209a-m.  How I edited the documents I'm scanning when the 3 output options are to create PDF or Tiff files?

    The button "scan" on the window of HP solutions says that you can "analyze and edit text with or without graph documents." Also, this website solutions indicates that I can edit documents that I scan.  But the 3 output to 'scan' options to create a PDF file, to send a PDF file or to create a Tiff file. I think that all of these types of files are not editable. I was not able to find an option to create text or Word files.

    Thanks for your help,

    Jim

    JSD says:

    I have a printer of HP Photosmart Plus b209a-m.  How I edited the documents I'm scanning when the 3 output options are to create PDF or Tiff files?

    The button "scan" on the window of HP solutions says that you can "analyze and edit text with or without graph documents." Also, this website solutions indicates that I can edit documents that I scan.  But the 3 output to 'scan' options to create a PDF file, to send a PDF file or to create a Tiff file. I think that all of these types of files are not editable. I was not able to find an option to create text or Word files.

    Software that comes with the printer HP Photosmart Plus B209a there OCR package in it. However, we can always install it by simply following procedure below:

    (1) perform a disk cleanup. (Start > all programs > Accessories > system tools > disk cleanup)

    (2) open the link below and save it on desktop OCR software

    FTP://ftp.HP.com/pub/Printers/ocragent/hpcom_OCR_140_003.exe

    (3) run the file after the download is complete.

    (4) if the error is displayed to indicate "this update does not support all of the HP device... ", do not close the message. It is very important.

    (5) open file folder

    (6) file open 7z

    (7) find the folder "ocr_web_pack".  Copy this folder on the desktop.

    8) click OK in the error message

    (9) open the "ocr_web_pack" file that is copied on the desktop and double-click "SETUP. "EXE" file

  • How do I add text when the button is in short

    Hi friends,

    I am the third party application.

    This header contains the BitmapFields when the focus moves to this imageat the bottom of the image, I want to mention the name of the image.

    Please tell me how to do this.

    Thank you in advance.

    Hello

    The descriptor, you're trying to find is known as ToolTip.

    Try this link.

    http://supportforums.BlackBerry.com/rim/attachments/rim/java_dev/163809/1/ToolTip_1.txt

    Thank you

    Krishnan

Maybe you are looking for

  • Expandable storage on 4th Gen Apple TV fault

    I had a thought, but could not verify the theory because I don't currently have an available external hard drive. I'm leaning towards a big NO fat on it, but is there a gap in the 32/64 GB of storage to the new AppleTV where you can plug in an extern

  • Advanced > network > offline storage displays more amount of cache

    I used to be able to see the amount of disk space used by Firefox before emptying the cache memory in Preferences > advanced > network > offline storage. Now, after the upgrade to version 6.0 on my Mac, it no longer displays the amount, and I don't k

  • HP pavilion 15-p107ne: replacement of Ram

    Hello I have hp pavilion p107ne, it has already installed 4 GB of ram and I want to add a more ram 1. is it agrred to ram with my phones: Kingston ValueRAM 8 GB SO - DIMM DDR3 PC3-12800 CL11 (KVR16S11/8) 2. is he able to add DDR4 Ram 3. What is the m

  • Error code: Ox80070424 (cannot install updates)

    How can I install the download for windows update without getting an error 0 X 80070424

  • PROBLEM SOLVED: 403 error, oops! Prohibited application?...

    If you received 403.Oops! Request forbidden? error message when you try to run the installation via the CD or product specific URL mentioned on the follow-up to the present Installation Guide the procedure below. Mac: 1-go to hpsupport.com > download