How to get the day as numeric value without formatting the date?

Hello,
to reduce the costs of a sql-statement I need to get the day of a date-value as number (to compare it to a numeric value) without any formatting. Every formatting results in a full table scan of the table with the date field. Is there any function to solve this problem?
Oracle version is 11g.
Thanks Carsten

CarstenDD wrote:
select T1.SYSID from T2,T1
where T2.SysT1 = T1.SYSID
and T2.Date1 < '01.03.2011' --German date format
and to_number(to_char(T2.Date2,'DD')) = 1
and T2.Inactive = 0
The explain plan shows a full table scan on T2. With EXTRACT(DAY FROM T2.Date2) there is no difference.It probably would and should in any case.
Look at your predicates, which of them would reduce the resultset to a fair size compared to the total number of records in the table?.
- You may have a huge number of records when you say date less than
- Of these perhaps one seventh have day = 1
- My guess is that most have Inactive = 0
Besides, you should not rely on implictit char to date conversion, always use TO_DATE
How many records are in the table? - How many will that query return?
Regards
Peter

Similar Messages

  • How do get rid of a tab group without closing the tabs? How do I take tabs out of a group?

    I accidentally put all my tabs in one group. I'd like to get rid of the group without closing all the tabs in it; in other words, to undo putting all the tabs in one group. It would be useful to know how to remove a tab from a group without closing the tab, accidentally putting a tab in the wrong group will probably be a common error that needs to be easily undone.

    '' SisqB;''
    ''I searched about:config and found a listing of "stuff" under the S3 Downloads ''
    Can you take a snapshot of what you see?
    In order to better assist you with your issue please provide us with a screenshot. If you need help to create a screenshot, please see [[How do I create a screenshot of my problem?]]
    Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. This will help us to visualize the problem.
    Thank you!

  • How to get Current day and month value in Stk applets

    Friends please provide me the hint to get the Current Value of month and date from the Mobile equipment(ME).
    please send feedback to [email protected]

    Use "PROVIDE LOCAL INFORMATION" command as per GSM 11.14. This however queries the handset date and time, and hence depends on the handset clock (which may not always be reliable).

  • How to get FormCalc to recognize a value as numeric

    I have spent several hours on this with no resolution and am hoping someone can help.
    I'm working on a form in LiveCycle 8. I'm trying to show/hide Field2 based on the value of Field1, but FormCalc seems not to recognize the value of Field1 as a number. This is the script that doesn't work:
    if (Field1.rawValue < 2.5) then
    Field2.presence = "invisible";
    else
    Field2.presence = "visible";
    endif
    I've also tried Field1.value, but it doesn't work either.
    However, this works:
    if (2 < 3) then
    Field2.presence = "invisible";
    else
    Field2.presence = "visible";
    endif
    If I manually change (2 < 3) to (2 > 3), the script also works perfectly in reverse.
    I've messageBoxed the value of Field1, and it displays the number I expect (i.e., it's not empty or too big or too small).
    How can I manipulate the value of Field1 so the first script will work? Or if there's some other workaround, I'm open to it.
    Thanks in advance!
    Kathryn

    JavaScript sometimes makes decisions as to what is a number and not. Depending upon how a number is inserted into a field can cause JavaScript to think a numeric string is a character string, and it is but a special case. This usually happens when using special format or the "util.pirntf()" method.So you can either use the multiplicative itdentity to force a field value to a numeric value or use the "Number()" constrictor.
    // multiply by 1
    if ( 1 * Field1.rawValue < 2.5) {
    Field2.presence = "invisible";
    }else{
    Field2.presence = "visible";
    // or use the numeric constrictor
    if (Number(Field1.rawValue) < 2.5) {
    Field2.presence = "invisible";
    }else{
    Field2.presence = "visible";

  • I got a text saying that if I don't pay my bill, my service is going to get cut off by the end of the day. I don't have the funds to pay it in full, so I paid half the amount. Would that suffice? Or would I have to pay it in its entirety to save my accoun

    I got a text saying that I don't pay my bill, my service is going to get cut off by the end of the day. I don't have the funds to pay it in full, so I paid half the amount. Would that suffice? Or would I have to pay it in its entirety to save my service from being cut off?

    As it was pointed out making prior arrangements could of helped extend the time you need to get your account back in order..
    But if you have to have the phone and its the only thing you have to make calls, I would try other means ( Family, Friends, or other )  to get the rest of the balance payed and you can pay at a Corporate store using the stores Kiosk machine.!   You can pay with Cash, Credit or I think with a  check  but using a check I'd ask the Local store how the policy is on that..
    Hope that Helps.!  Good luck..

  • How to get POF object's field value from query result

    hi,all:
    I want to get field value from the query result, my code is below
    Set setResults = cache.entrySet(createFilter("homeAddress.state = 'MA'"));
    for (Iterator iter = setResults.iterator(); iter.hasNext(); )
    Contact c=(Contact)iter.next();
    System.out.println ("firstame####=" + c.getFirstName());
    * but I get error*
    Exception in thread "main" java.lang.ClassCastException: com.tangosol.util.ConverterCollec
    tions$ConverterEntrySet$ConverterEntry cannot be cast to com.oracle.handson.Contact
    at com.oracle.handson.QueryExample.printResults(QueryExample.java:159)
    at com.oracle.handson.QueryExample.query(QueryExample.java:86)
    at com.oracle.handson.QueryExample.main(QueryExample.java:43)
    who can tell me how to get POF object's field value from query result

    Hi,
    If you look at the Java Doc for the entrySet method here http://download.oracle.com/docs/cd/E15357_01/coh.360/e15725/com/tangosol/util/QueryMap.html#entrySet_com_tangosol_util_Filter_ you will see that it returns a Set of Map.Entry instances so you need to do this...
    Set setResults = cache.entrySet(createFilter("homeAddress.state = 'MA'"));
    for (Iterator iter = setResults.iterator(); iter.hasNext(); )
        Map.Entry entry = iter.next();
        Contact c=(Contact)entry.getValue();
        System.out.println ("firstame####=" + c.getFirstName());
    }JK

  • I just bought my phone few days ago. From the day I bought it I realized the phone heats up after a little use. It gets really hot while using Wifi and downloading. Anyone else having these issues? What's the solution to this?

    From the day I bought it I realized the phone heats up after a little use. It gets really hot while using Wifi and downloading. Anyone else having these issues? What's the solution to this?

    Your VGA is definitely corrupted and it is irreparable, so just make the HP to change your vga.
    Also next time read my post on how to keep your laptop cool to avoid same issues again.
    I assume your laptop was pretty hot during some time and that's the result you've got.
    Make it easier for other people to find solutions, by marking my answer with 'Accept as Solution', if it solves your problem.
    Click on the BLUE KUDOS button on the left to say "Thanks"

  • How to get column names for a specific view in the scheme?

    how to get column names for a specific view in the scheme?
    TIA
    Don't have DD on the wall anymore....

    or this?
    SQL> select text from ALL_VIEWS
      2  where VIEW_NAME
      3  ='EMP_VIEW';
    TEXT
    SELECT empno,ename FROM EMP
    WHERE empno=10

  • I just got the iphone 4s and i cant figure out how to get siri to work it seems to be the old voice command. HELP!

    i just got the iphone 4s and i cant figure out how to get siri to work it seems to be the old voice command. HELP!

    Did you enable Siri in settings?
    Settings > General > Siri > ON
    If Siri is off, all you get when pressing the home button for 1 second is the old Voice Control.

  • How do you get your music on your phone without syncing the whole iTunes library on your phone?

    How do you get your music on your phone without syncing the whole iTunes library on your phone?

    Are you syncing to a different computer?  Iphone will sycn with only one at a time.  Syncing to another will erase the current content.
    Otherwise, just select what you want to be on the iphone under the music tab and sync.  What do you care if it erases?  You will be syncing what you want to the iphone.

  • How to get first item of hashMap w/out knowing the key

    Hi
    can someone tell me if there is a way to get first item from a hashMap when you dont know what the key is. as the get method expects a defined 'key'
    reason I am asking this:
    I am using struts 2 UI <s:radio> tag. this tag takes a hashmap and creates radio maps. it has a 'value' attribute and if something is passed to this attribute then that radio button is checked by default. the list that contains radio buttons is created dynamically so i dont know what is actually in the hashMap key's. but i do know that key's are string.
    so just wondering if there is a way to get first item from a hashmap without knowing the key...

    thanks for the quick reply.
    posted in java forums because thought it was a java API/workaround question. gave a little history because i didnt want people to start questioning my use of HashMap for this purpose..
    anywhose..i've found a workaround.
    If someone has a similar problem:
    as the hashmap is being populated dynamically....set a String member of class to contain the first key thats being put in the hashmap. then have struts tag pick up that value.
    also, through your post and reading hashMap api...its usefull to know that hasMaps do not gurantee the order of elements in it. So now I am using a TreeMap.
    Thanks

  • How to get Text from (.txt) file to display in the JTextArea ?

    How to get Text from (.txt) file to display in the JTextArea ?
    is there any code please tell me i am begginer and trying to get data from a text file to display in the JTextArea /... please help...

    public static void readText() {
      try {
        File testFile = new File(WorkingDirectory + "ctrlFile.txt");
        if (testFile.exists()){
          BufferedReader br = new BufferedReader(new FileReader("ctrlFile.txt"));
          String s = br.readLine();
          while (s != null)  {
            System.out.println(s);
            s = br.readLine();
          br.close();
      catch (IOException ex){ex.printStackTrace();}
    }rykk

  • Does anyone know how to get a preflight file signed by apple for the 21 mac

    does anyone know how to get a preflight file signed by apple for the 21 mac

    im trying to get a hold of them to see if they can deauthorize a computer. I am unable to do it because i can't get the internet to hook up. And i got a new laptop that i get the internet on but i can't authorize it unless i deauthorize the other one. i've called apple 3 times and theyve not been very helpful saying i need to get  hold of itunes.

  • HT4962 how i get ios 5 on my ipod 3g becuase the version is too old 4.2.1

    how i get ios 5 on my ipod 3g becuase the version is too old 4.2.1

    Very likely since yu really have a 2G iPod. Those only go to 4.2.1. If your is an 8 or 16 GB one it is a 2G since Apple only made 32 and 64 GB 3G iPods. A 32 GB one can be either. See:
    http://support.apple.com/kb/HT1353#iPod_touch_late2009
    The iPod touch (3rd generation) can be distinguished from iPod touch (2nd generation) by looking at the back of the device. In the text below the engraving, look for the model number. iPod touch (2nd generation) is model A1288, and iPod touch (3rd generation) is model A1318.

  • How to find the Day on a Week for any given Date

    Hi..... I need your help to find out the Day on a Week for any given Date .
    Say if the Date is 31/12/2009 , what would be the Day on a Week for this Date.
    Are there any fucntions available to determine the same?
    Please let me know....Thanks in Advance
    Regards
    Smita

    Hi ,
    You can using the following peice of code to get the Day of a Week for the given date :
    Calendar now = Calendar.getInstance();   
    System.out.println("Current date : " + (now.get(Calendar.MONTH) + 1)  
         + "-" + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR));
    //create an array of days  
    //Day_OF_WEEK starts from 1 while array index starts from 0        
    String[] strDays = new String[]{"Sunday",  "Monday", "Tuesday", "Wednesday",  "Thusday",   "Friday",  "Saturday" };   
    String day_of_week = strDays[now.get(Calendar.DAY_OF_WEEK) - 1];     
    System.out.println("Current day is : " + strDays[now.get(Calendar.DAY_OF_WEEK) - 1]  );
    Edited by: Ritushree Saha on Jun 4, 2009 1:09 PM

Maybe you are looking for

  • Can two people share an iMatch account?

    My partner and I have our own iPads and iMacs, I also have a MacBook for work. The iTunes account is mine, and we would like to be able to share the iMatch for our music so we can share our libraries and both access the music stored in the cloud. Can

  • OS 10.4.11 FTP Permissions set to 640 on Upload

    I have a G4 in my classroom running OS 10.4.11 (not OS X Server) with Personal Web Sharing and FTP turned on. My students upload web pages to it over FTP. Whenever they upload a NEW file, permissions get set to 640 on the server. Of course this preve

  • IPod Touch is not recognized in intunes

    Using Vista SP3 and fresh uninstall/install of iTunes.  iPod Touch shows up in Device Manager as "Apple iPod" with "Digital Camera" driver from Microsoft.  If I change it to "Apple Mobile Device Driver", I get error 37 - cannot start device

  • Where I can get the NI-CAN 1.3? not the latest.

    I need to use the NI-CAN 1.3 because I have some programs that are based on this version so I don't want the latest because I have it. Thanks for your help...

  • Airport Utility won't work with Windows 8

    With Windows 8 I can't get Airport Utility versions 5.5.3 or 5.6.1 to recognize my airport express when wireless.  It can see it if I connect it to the computer with Ethernet.  Another computer with Windows 7 works just fine.  Any idease on how to fi