Problem in dealing with date

Hello

I use oracle 11g R2 xe.
I have a weird case. I have about 30 folders created on 08/01/2012

When I type this:
"Select * from TABLE where calling_date = January 8, 2012"
I have only 9 entries.
But,
If I type:
"Select * from TABLE where calling_date > 7 January 2012"
I get 30 reviews who created 08/01/2012

What could be the problem...?

I use this trigger to insert the value from the date of the call

CREATE OR REPLACE TRIGGER "BI_Create_CRM".
BEFORE INSERT OR UPDATE ON CRM
FOR EACH LINE
Start
If (insert) and then
Start
: new.calling_date: = sysdate;
end;
end if;
end;

Kind regards
Fateh

Fateh says:
Hello

I use oracle 11g R2 xe.
I have a weird case. I have about 30 folders created on 08/01/2012

When I type this:
"Select * from TABLE where calling_date = January 8, 2012"
I have only 9 entries.
But,
If I type:
"Select * from TABLE where calling_date > 7 January 2012"
I get 30 reviews who created 08/01/2012

What could be the problem...?

I use this trigger to insert the value from the date of the call

CREATE OR REPLACE TRIGGER "BI_Create_CRM".
BEFORE INSERT OR UPDATE ON CRM
FOR EACH LINE
Start
If (insert) and then
Start
: new.calling_date: = sysdate;
end;
end if;
end;

Kind regards
Fateh

It's just that you totally ignored the part time. A date data type has the time associated with it. You can see that.

SQL> alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'
  2  /

Session altered.

SQL> select sysdate from dual
  2  /

SYSDATE
--------------------
10-JAN-2012 08:39:45

"Select * from TABLE where calling_date > 7 January 2012"

This very incorrect way of writing a query. Here you have treated the date as a string. So, this will cause conversion implisit.

How it should be wirttern is.

select * from table where trunc(calling_date) = to_date('01-07-2012','dd-mm-yyyy')

Yet this will not consider the index (if any) in the calling_date column. So what can we do?

You can do instead.

select * from table where calling_date between to_date('01-07-2012','dd-mm-yyyy') and to_date('01-08-2012','dd-mm-yyyy') - interval '1' second

Tags: Database

Similar Questions

  • Problems updating default_where with date values

    Hello

    I want to update the attribute default_where with date values. the form is initialized, the attribute default_where = Lieferdatum > =: AB2.von AND Lieferdatum < =: AB2. BIS
    Then, I select the query.
    by fireing the trigger when-click of the mouse, I want to select only the witch value content items: Lieferdatum

    declare
    v_bestellnr varchar (200);
    test varchar (200);

    Start

    v_bestellnr: =: k_falschgeladen_vw. Lieferdatum;
    test: = 'LIEFERDATUM =' | v_bestellnr;
    Set_Block_Property ('K_FALSCHGELADEN_VW' test, DEFAULT_WHERE),
    EXECUTE_QUERY;

    end;

    I get the message FRM-40505 query could not be reached

    Paper copy of the formdeveloper http://www.neusob.de/~RobertKoch/dok1-Dateien/image002.jpg

    so, how can I get good value in the default_where attribute

    I hope that the: k_falschgeladen_vw. Lieferdatum is date data type. If so, try the following:

    Set_Block_Property('K_FALSCHGELADEN_VW', DEFAULT_WHERE, 'LIEFERDATUM=TO_DATE(''' || TO_CHAR(:k_falschgeladen_vw.Lieferdatum, 'DD.MM.YYYY') || ''', ''DD.MM.YYYY'')');
    EXECUTE_QUERY;
    
  • Passport problems of blackBerry with date and time on the passport of Blackberry

    Hello!
    I have problems with my passport for Blackberry.
    For the couple in a day time, it changes itself. So my hub doesn't work, I get no new messages, I can't send messages! The last time I did correct settings did not help. If everything is correct or hub or messages do not work. I tried to make different adjustments, tried to restart the hub, tried to restart the phone. but it does not work. I really need your help because I can't use my phone and nobody can connect with me.
    I didn't drop the phone. I know that these problems are related to the date and time because since the first problem with hub and messages has occurred, I saw that the date and time were bad, changed to correct and everything went well. I don't understand why he doesn't now. Can you tell me what to do?
    OS 10.3.2.2836
    1 January, I received this phone and it worked allright until some of the OS updates, can't tell which exactly because I have auto update.

    For those who have the same problem: I deleted the contact of my mother on the phone. I deleted the messages displayed as January 27, then I added my mother to local contacts and new messages started coming

  • How to clear a session will deal with data manager form.

    Hi all

    I have a form handler, which is an element of extended session. On the page of jsp form, I have two fields (in sections) that refers to the same property in the form Manager.

    The data fields are as shown below

    In section 1 - customerName

    In section 2 - customerName

    If I enter data for customerName section1 and submits the form.

    After you have submitted data, if I go back to the same page, the customerName in both sections fields are filled with the data I entered previously. I do not want the data to appear when I return to the page of the form. How to clear the contents of the form Manager.

    Kind regards

    Yousuf.

    Why do you want to use scope of session for formhandlers? its not recommended.

    But if you want to reset all the fields, and then override the beforeGet() method in formhandler and defined all NULL values.

    Peace

    Shaik

  • How to deal with date?

    How can I replace the XXX in the query below to retrieve the number of transactions that happened every month since January 1st 2008 ' to 31-dec-2008' grouped by dept_id?

    Select dept_no, count (transation_no)
    from the sale
    where trans_date XXX
    Dept_no group

    THX

    Hello

    homesick1984 wrote:
    Thank you all for the quick answer :)

    But, I want just the departments including the transactions that happened each month in the year 2008, i.e., if dept_no = 555 a transactions each month in the year 2008, so should I bring it and no.. of these transactions

    thnx :)

    In this case, use a HAVING clause:

    select    dept_no
    ,        count (transation_no)      AS cnt
    from        sales
    where        trans_date     >= TO_DATE ( '01-Jan-2008'
                               , 'DD-Mon-YYYY'
                           )
    and       trans_date     <  TO_DATE ( '01-Jan-2009'
                               , 'DD-Mon-YYYY'
                           )
    group by  dept_no
    having       COUNT (DISTINCT TRUNC (trans_date, 'Month')) = 12
    ;
    

    If it is still not what you want, then after a few examples of data (CREATE TABLE and INSERT statements) and the results desired from these data.
    Simplify as much as possible. For example, reduce the interest from 12 to 3 months period.

  • Dealing with Dates

    Hi guys,.

    I need to select the lines that have been created in the last 10 days. I used this query, but it wouldn't work.

    SELECT * from CRM where to_date (calling_date, "MM\DD\YY") between to_date (sysdate, 'MM\DD\YY') and to_date (sysdate - 10, "MM\DD\YY")

    Best regards
    Fateh

    I hope you noticed that ;)

    ... between sysdate - 10 and sysdate
    

    Concerning

    Etbin

  • Dealing with the Dates 2

    Hi guys,.

    I'm not a regular developer, I met always hedges when dealing with dates.

    I have a timestamp column, called 'Calling_date' which stores values as this "24 July 12 AM 05.30.00.000000".

    My report must show the data in this column as "YY-MM-DD hh: mi". I tried two methods but none worked.
    * I won't use To_char *.

    trunc (calling_time, "HH24 DD-MM-YY")
    ORA-01898: too much precision specifier

    TO_DATE (calling_time,'DD-MON-YY hh: mi ')
    ORA-01830: date format picture ends before converting all of the input string

    PLS, tell which can achieve my task.
    Kind regards
    FAteh...

    Fateh says:

    I have a timestamp column, called 'Calling_date' which stores values as this "24 July 12 AM 05.30.00.000000".

    My report must show the data in this column as "YY-MM-DD hh: mi". I tried two methods but none worked.
    * I won't use To_char *.

    Why not use TO_CHAR() ?

    Date and timestamp formats are BINARY formats. Is not a screen formats.

    This means that we MUST convert that binary in a human readable format. TO_CHAR() allows exactly that - convert to a format readable by humans and which allows you to specify exactly what that format is.

  • Error blackBerry software - synchronization failed, impossible to deal with organizing data

    I had a Q10 Blackberry last week.  I downloaded and installed the PC of Blackberry link 1.2.2.13 version.  Two-way sync USB worked fine.  Now, all of a sudden, I get the error message "synchronization failed, impossible to deal with organizing data."   I tried to reset the synchronization options, but not joy.  Also tried to uninstall and reinstall the software Link 1.2.2.13, once again no joy.  Any suggestions?

    UPDATE: I spent 4 hours on the phone and the remote session with the help of Blackberry last night.  After doing some troubleshooting to isolate the problem, determined that something on the device caused the problem of Outlook synchronization. One thing I've learned, it's that it can take a long time to synchronize and even though the progress of the screen may appear frozen, let it go until the end - sometimes it took 20-25 minutes, but eventually completed. Here's the process we went through - I would recommend appellant help BB and work with them to make sure you have not accidentally delete Outlook contacts and calendar of important information of your PC or BB device!.

    (1) we tried an uninstall/reinstall the PC Link BB software and that did not fix the problem.

    (2) to isolate the problem of synchronization.  We first did a synchronization of 2 channels 'contacts' and 'calendar' and who was a failure.  Then did a synchronization of only 2 channels 'contacts' and managed.  Then did a synchronization of only 2-way 'calendar' and that was a failure - so the problem was linked to calendar data and something on the device has been the cause of the problem or corrupted.

    (3) link BB allowing us to make a backup complete unit.

    4) then decided to do a 'Wipe security' on the device of BB Q10 to erase all the data and settings and return to a clean boot device configuration.  I was nervous about it - make double sure that Outlook all contacts and calendar data on the device and the PC are completely backed up in case something bad happens.  Nothing serious happened, but I was gald, we made the backup!

    (5) has the 'Security Wipe' feature (on the device, the settings > Security and privacy > wipe security) and phone rebooted without problems (takes a while to do).

    (6) then used link BB to do a sync test 1 channel 'contacts and calendar' from PC to device.  It worked without problem.

    (7) we then used BB link do a "restore" full backup of device, as we did in step 3 above.  It takes a while to make and was a success.

    (8) once the restoration of the aircraft was complete, BB link configured to perform a synchronization of 2 channels of the two 'contacts' and 'calendar '.  Does the synchronization and was a success.  Did a test by adding the new entry of the calendar on PC and did another 2-way sync - all worked very well.  Seems that the problem has been corrected, but will follow in the coming days.

    Lessons learned:

    (1) If you have a lot of Outlook contacts and calendar entries, the synchronization may take a long time.  Be patient and let it run - even if it seems stuck, etc!

    (2) save all Outlook data on the device and the PC to make sure that you have a backup something bad happened during troubleshooting.  We had not something bad happens, but I was gald we made a backup anyway.

    (2) call BB help - support person, I worked with was fabulous, even if it took some time to work through a patch.

     

  • Problem of UK with ASP and Access database date format

    I have an Asp form that updates of the records in a database Access. It comes
    the date of the registration of database format is dd/mm/yyyy (UK), when
    the folder is displayed in the form, it is mm/dd/yyyy (US) who, after I
    update the record in the database, the date has changed to the new format.

    I tried everything I can to change the format
    vain... someone at - it any ideas how I can fix this?


    Thank you
    Steve

    Stevo.s wrote:
    > Hi
    >
    > I tried to change the format on the date field on the server behaviors
    > panelto DDMMYYYY. Also have tried to define the field of form DDMMYY format. I have
    > also tried to use a function that I got from a somehwere to post on the net or not
    > avail. < %="" fonction="" ddmmyyyy(vardate)=""> < br=""> > DDMMYYYY = Day (DateValue (varDate)) & "/" & Month (DateValue (varDate)) < br=""> > & "/" & Year (DateValue (varDate)) < br=""> > end function < br=""> > < br=""> > I believe that it is a problem with Dreamweaver and access but < br=""> > can't seem to grasp her work around! Problem being that I teach myself through < br=""> > books and internet articles and can take weeks at a time without being able to < br=""> > watch question... whenever I come back to it, it's like start all over < br="" >="" >="" nouveau !="" j’espérais="" que="" quelque="" part="" de="" sortir="" là,="" il="" y="" a="" une="" solution="" simple="" le=""> < br=""> > may deliver a datePicker with the built-in functionality to address the < br=""> > question... I am wanting to understand how to deal with the issue rather than simply < br=""> > change my date field of database to fudge the issue that I'm in England and when I < br=""> > eventually start using the application, I wish there is some < br=""> > coherence with the dates of arrival and that users are familiar with the format. < br=""> > < br=""> > any help gratefully received!

    Its not Dreamweaver, or access, its your settings regional servers, his game to the United States < br=""> format, not in the United Kingdom.

    On your page at the top of the page using:

    < %="" session.lcid="2057" %="">

    This will force the page using UK format dates. Use it on any
    page to format the page correctly.

    Dooza
    --
    Display guidelines
    http://www.Adobe.com/support/forums/guidelines.html
    How to ask Smart Questions
    http://www.CatB.org/ESR/FAQs/smart-questions.html

  • Dealing with problem FileConnection class

    Hello guys I am experiencing problem dealing with FileConnection class. My app uses the class "javax.microedition.io.file.FileConnection". And when to start the application, the problem occurs that

    "Error starting ApplicationName class 'javax.microedition.io.file.Fileconnection' not found."

    My device name: BlackBerry8703e

    OS version: 4.1.0 profile / Verizon Wireless BlackBerry

    Do you know this problem? How can I solve it?

    TNX'

    FileConnection is supported to 4.2.0.

  • There is a problem of storage with the data path [path to hard] store

    I have two sites connected by using a VPN connection over a WAN link. In each site, I have an esxi with several VMS host and operation of replication device of vSphere (v 5.1.1.0 Build 1079383) in each site. In each site, these is also a vCenter server with the device of RVS registered and logged with the other site. All the virtual machines are configured to replicate to the other site.

    In my initial configuration of the RV (first install) site remote had 2 vNIC used for the management and I figured it was my problem with replication (see kb2040302). So I have changed since my host configuration from the remote site to have that single vnic management (does not solve the problem). I then registered, removed and reinstalled the VR device without change to the problem.

    What is going on:

    1. I am able to configure replication between sites without a problem.

    2. first replication occurs between sites and reports a success.

    3. the remote VM replication to the main site continue to work properly and all is well for the days and continue to work.

    4. the main site of VM replication to the remote site fails on the second and all attempts to reproduce the error. There is a problem of storage with datastore path '[datastorename] '.

    ReplicationError.JPG

    I followed the advice of kb2040302 better as I can. But I must confess that I could use some of the more detailed instructions on how and what site should I check the logs. and how to check my configuration management vnic.

    I'm looking for someone provide additional troubleshooting steps with good detail.

    Thank you


    Resolution:

    The problem was caused by a security setting on the NFS Server data store. VRA could not delete the (hard).

    Specifically, my problem was with authorizations on the Synology NAS under the application of the "file Station.

  • regexp: how to deal with different date formats?

    the date comes as varchar2 with '-'and':' as separators for day part and part time respectively. but it may come with different formats such as

    1993-05-17
    1993-05-17 13:04:23
    1993-05-17 13:04
    1993-05-17 13:4
    1993-05-17 13:04
    1993-05-17 13:4:2
    1993-5-17-13:4:2
    1993-5-7-13:4:2

    and so on. date of final format should be ' YYYY-MM-DD HH24-SS'. is it possible to have an intelligent way to deal with different formats of date with separators above and convert the final using regexp format, so that it is compact and universal as possible with assumptions/examples above?

    Thank you

    As others have said, the smartest way is to keep your input in a format method and store your data in a date column.
    But is a simple way to deal with this mess, without regexp,

    with test as (
    select '1993-05-17' d from dual
    union all select '1993-05-17 13:04:23' from dual
    union all select '1993-05-17 13:04' from dual
    union all select '1993-05-17 13:4' from dual
    union all select '1993-05-17 13:4:2' from dual
    union all select '1993-5-17 13:4:2' from dual
    union all select '1993-5-7 13:4:2' from dual
    union all select '1993-05-17 1:4 PM' from dual
    )
    select d
         , to_date( translate( d, 'xampAMP', 'x' )
                  , 'yyyy-mm-dd hh24:mi:ss'
                  )
         + case when instr( upper( d ), 'P' ) > 0 then 0.5 else 0 end cd
    from test
    
  • problems with DATE

    Hello

    I have the following plsql:
    DECLARE
       TYPE record_t
       IS
          RECORD (
             col_1    DATE,
             col_2   VARCHAR2 (7),
             col_3    VARCHAR2 (1)
          );
    
       l_record    record_t;
       l_ref_cur   dyn_fetch.ref_cur_t;
    BEGIN
       l_ref_cur := helper.ref_cur;
    
       LOOP
          FETCH l_ref_cur INTO   l_record;
    
          EXIT WHEN l_ref_cur%NOTFOUND;
    
          ELSIF (LOWER (l_record.col_3) = 'd')
          THEN
             DELETE FROM  table_new
                   WHERE   MY_DATE = TO_DATE (l_record.col_1);
    
             DBMS_OUTPUT.put_line ('here it is: ' || l_record.col_1);
          END IF;
       END LOOP;
    
       CLOSE l_ref_cur;
    END;
    So, the problem is, that 'L_RECORD. COL_1"returns dates in the form: jj. MM YY

    It works very well with most of the files, but it does not find the file with date = 15.08.1930. Then I l_record.col_1 = 15.08.30! Maybe the problem is that oracle is not sure if she should return * 1930 or 2030 *...

    So, how can I solve this problem, I want to return the l_record.col_1 * 15.08.1930 *, NOT 15.08.30!

    Should I change the definition of the record_t type?

    Thank you!

    Your record definition defines COL_1 as a date, so there is not need to convert a date value in this column.

    Remove the TO_DATE() function inside the loop.

  • Problem filling tabnavigator with returned data

    I'm trying to fill a tabnavigator with data. I feel that only the first tab displays data, but each subsequent tab does not work. It seems that when you click on another tab it loses the value of 'key' past. What is the reason for this and how can I fix the value of the 'key' for all tabs?

    Thank you!


    Here is my code:

    <? XML version = "1.0" encoding = "utf-8"? >
    "" "" < cfComponents:SizeableTitleWindow xmlns:mx = ' http://www.adobe.com/2006/mxml ' xmlns = "*".
    xmlns:cfComponents = "" com.adobe.ColdFusion.Components. * ""
    xmlns:cfDataGrid = "" com.adobe.ColdFusion.Components.DataGrid. * ""
    xmlns: Model = "" com.cfgenerated.Models. * ""
    xmlns:view = "" com.cfgenerated.views.detail.Movie. * ""
    creationComplete = "initComponent () '"
    explicitMaxHeight = "{Application.application.height - 50}" "
    title = "Details".
    showCloseButton = "true".
    Close = "WindowManager.Remove (this); ">


    < mx:Metadata >
    [Event ("change")]
    < / mx:Metadata >

    < mx:Script >
    <! [CDATA]
    Import mx.utils.ObjectUtil;
    Import mx.controls.Alert;
    Import mx.core.Application;
    Import mx.validators.Validator;
    import com.adobe.windowedApplication.managers.WindowManager;
    Import mx.rpc.events.ResultEvent;
    Import mx.rpc.events.FaultEvent;
    com.cfgenerated.models import. *;

    private var _key:Object;

    public function get keys (): Object {}
    return this ._key;
    }

    public function set {key(key:Object):void}
    This ._key = key;
    getItem();
    }

    private function initComponent (): void {}
    this.detailObject = new MovieDetailstblMovies();
    }

    /*
    Calls to the remote and managers call back Server
    */
    Gets an instance of the server item
    public function getItem (): void {}
    If (this ._key! = null) {}
    this.dataManager.getById (this._key);
    }
    else {}
    the key is null, then we create a new object for the operation 'Add '.
    this.detailObject = new MovieDetailstblMovies();
    }
    }

    private void saveItem(item:Object):void {}
    this.dataManager.save (item);
    }

    private void get_result(event:ResultEvent):void {}
    detail of the var: MovieDetailstblMovies = event.result as MovieDetailstblMovies;
    this.detailObject = details;
    }

    []] >
    < / mx:Script >

    < mx:RemoteObject id = "dataManager" showBusyCursor = "true" destination = "ColdFusion".
    source = "MyTest.Components.cfgenerated.MovieDetails.tblMoviesGateway" > "
    < name mx:method = "getById" result = "get_result (event)" / >
    < / mx:RemoteObject >

    <!-create a template using the AS value object class. With this the model mxml version, we can bind the form fields in the object. ->
    < model: MovieDetailstblMovies id = "detailObject" >
    < model: title > {tblMovies_title.text as String} < / template: title >
    < description: model > {tblMovies_description.text as String} < / model: description >
    < model: features > {tblMovies_features.text as String} < / model: features >
    < / template: MovieDetailstblMovies >

    < mx:TabNavigator width = '675' height = '408' >
    < mx:Canvas label = "Tab1" width = "100%" height = "100%" >
    < mx:Label text = "Title" x = "10" y = "10" / >
    < cfComponents:TextInputMask id = text = "{this.detailObject.title"tblMovies_title"}" width = "220" y = "36" x = "10" / > "
    < / mx:Canvas >
    < mx:Canvas label = "Tab2" width = "100%" height = "100%" >
    < cfComponents:TextInputMask id = text = "{this.detailObject.description"tblMovies_description"}" width = "351" height = "138" x = "10" y = "36" / > "
    < mx:Label x = "10" y = "10" text = "Description" / >
    < / mx:Canvas >
    < mx:Canvas label = "Tab 3" width = "100%" height = "100%" >
    < mx:Label text = 'Bonus' x = "10" y = "10" / >
    < cfComponents:TextInputMask id = "tblMovies_features" text = "{this.detailObject.features}" width = "291" height = "218" x = "10" y = "36" / > "
    < / mx:Canvas >
    < / mx:TabNavigator >

    < / cfComponents:SizeableTitleWindow >

    By default the TabNavigator only creates the contents of the first child. Try adding creationPolicy = "all" to the tag TabNavigator.

  • 100 requests to continue POST deal with error in Firefox 24

    BUG Firefox 24!
    24 Firefox manages POST requests with the error: when 100 continue answers are preceded by 200 OK response, and then Firefox does not deal with other responses (including 200 OK response) after receipt of the response to continue first 100.
    Earlier versions more handle 100 continue properly.

    I'm sorry, I tested my script with Mozilla Firefox 25 - was the same problem. But then I spilled http connection - the newspaper said then 100 response continues and 100 OK data are mixed and gzip'ped. Then I disable deflate module for my Apache Server - and all become Okey! So, I just disable the compaction modules incorrect return data to solve the problem. Web server: apache2-mpm-itk on Debian Linux winded 7.

Maybe you are looking for