PL SQL Date Question

Hi all

Currently, we generate a payroll file manually by entering the date range. The date range covers 14 days. I would use "date_column" > = (sysdate) - 14 and "date_column" < (sysdate)-1 to eliminate the manual date entry process. Example when the file is generated specialist Payroll entered "date_column" > = 27 February 15 "and"date_column' < 12 March 15 '. " When I ran the application on 13 March 15 using "date_column" > = (sysdate) - 14 and "date_column" < (sysdate)-1 final results vary. Can someone please help.

(a). 13 March 15 ' isn't a date, it's a varchar. You must call to_date on it

(b) use 4 digits to represent a year, not 2

(c) that means "final results will vary"?

(d). we cannot start what we cannot see...

Tags: Database

Similar Questions

  • SQL * Net questions - which forum?

    Does anyone know what forum manages SQL * Net questions?

    THX

    For general issues, it's probably as good a place to ask as any.

    If you have SQL * Net questions that are specific to a particular technology (i.e. how various options of TNS interact with different configurations of CARS), you probably want to ask in the forums dedicated to these products.

    Justin

  • Does not not for java.sql.Date sort field

    Hi Experts ADF,

    JDev version 11.1.1.7.0

    I use a POJO based datacontrol, who is dragged like a table on page JSFF. One of the field is a java.sql.Date data type in POJO.

    So for example in the table 4 values are there to this date field as

    2.2.2014

    3.2.2014

    31.1.2014

    to 31.12.2013

    So while sorting in ascending order, it should come as below

    to 31.12.2013

    31.1.2014

    2.2.2014

    3.2.2014

    And vice-versa.

    But if I click on sort it sorts by the first 2 digits only, and I'm under results for sorting (ascending)

    2.2.2014

    3.2.2014

    31.1.2014

    to 31.12.2013

    Please suggest on this. Thanks in advance.

    Thank you

    Animesh

    Hi This sorting has been solved by changing of java.util.Date.

    Yes his watch to the client as an outputText inside the table. Sorting option is there for af:column.

    Thank you

    Roy

  • In general, is it better to use java.sql.Date and java.sql.Timestamp instead of oracle.jbo.domain.Date?

    Hello world

    During playback of Oracle ADF Real World Developer's Guide, I noticed the dates match occurring in JDeveloper is different from what is the list in the book. JDeveloper is failing to oracle.jbo.domain.Date, but according to the book:

    DATEjava.sql.DateDATE type is mapped to java.sql.Date if the column in the table is a no time didn't need information zone.
    DATEjava.sql.TimestampDATE type is mapped to java.sql.Timestamp if the column in the table has a component "time" and that the client needs to zone information.
    TIMESTAMPjava.sql.TimestampThe TIMESTAMP type is mapped to java.sql.Timestamp if nanosecond precision is used in the database.

    In general, is it better to use java.sql.Date and java.sql.Timestamp instead of oracle.jbo.domain.Date? Using java.sql.Date and java.sql.Timestamp could save me some headaches conversion date. And, is there a place in JDeveloper to display these maps? I looked around and didn't see anything.

    Thank you.

    James

    User, what version of jdev we are talking about?

    In GR 11, 1 material versions db types date and timestamp are mapped to types of domain data that represents a wrapper for the native data types. The reason was that the framework can work with the domain types regardless of the underlying data type.

    Since Oracle 11 GR 2 maps the types DB to java types (default selection, you can change it when you create a model project, you can set the Data Type Mapping). Once the pilot has business components define you cannot change this setting it would break existing components such as eo or vo.

    So if you are working wit 11 GR 1 subject, you must use the domain types, if you work with GR 11, 2 or 12 c, you can use the domain types, but it is recommended to use the java type mapping.

    Timo

  • The maximum size of the model in SQL Data Modeler?

    Hello

    The number of objects is the maximum value that can be used in a model in SQL data maker. I reverse engineered a scheme (see previous posts - thank you to all that helped) which contains 1000 + tables (a candidate for remanufacturing if ever I saw a!) but the Data Modeler is struggling to display them and performs very slowly. I can pull the same schema in the Oracle Designer and that works well, as ERwin-t - y at - it something I can do to improve the performance of the Data Modeler?

    Or people would recommend cutting the model into smaller pieces, which will be a little difficult because it's a bit of a rat's nest.

    John

    Hi John,.

    You can try to fix the memory usage - Re: problem of memory with large model

    And you may have better performance if divide you large diagram in subviews.

    Philippe

  • Problem with the two EA DEVELOPER SQL DATA MODELING 3.0.0.665 and 3.1

    I created a model of very large data using SQL Developer data 3.0.0.665 and 3.1 EA maker. Its having a lot of check constraints. Whenever I am the design of the fence and the DOF and reopening export to import the DDL file failure to import completely check constraints. It is important to check constraints, but without any range of values inside. Its very frustrating because whenever you open import ddl, you must manually add again all the details of data check range constraint.

    OS: Windows XP.
    Check in the two EA Developer SQL Data Modeler 3.0.0.665 and 3.1

    -------------------------------------------
    Here are the contents of the .dmd file.
    -------------------------------------------
    * <? XML version = "1.0" encoding = "UTF - 8"? > *.
    * < OSDM_Design class = "oracle.dbtools.crest.model.design.Design" name = 'Admin_Panel' id = "9BE18B0A-6C67-2E5B-00DE-BD8312189ECB" version = "3.41" > * "
    * < createdBy > administrator < / createdBy > *.
    * < Createduserid > 2011-10-17 08:32:18 UTC < / Createduserid > *.
    * < Admin_Panel ownerDesignName > < / ownerDesignName > *.
    * < false capitalNames > < / capitalNames > *.
    * < designId > 9BE18B0A-6C67-2E5B-00DE-BD8312189ECB < / designId > *.
    * < / OSDM_Design > *.

    -------------------------------------------------------------------------------
    An example how the check constraints to get dirty.
    -------------------------------------------------------------------------------
    Initial check constraint is as below:
    ======================
    ALTER TABLE test_table
    ADD CONSTRAINT Active_Flag_ck
    CHECK (Active_Flag IN ('A', 'I'))
    *;*

    Below how it occurs once I have imported the ddl and re-export:
    ============================================
    ALTER TABLE test_table
    ADD CONSTRAINT Active_Flag_ck
    (CHECK)
    *;*

    I'm in trouble as I already in the middle of the my development using SQL Developer Data Modeler.

    Please help me soon.

    Jean

    Hi John,.

    Every time I'm fence design and export the ddl and reopening through the import of the DDL file

    Why are you doing this? Once the DDL file is imported and then save the drawing and open simply saved design, no need to generate the DDL and import it every time that you start Modeler data.
    On the list of values - forced as this CHECK (Active_Flag IN ('A', 'I')) are imported as constraint check plain and not as a list of values.
    There are the more specific elements import of check constraint - they are defined as type database constraint that you select during the import. Accordingly if you import your DOF as Oracle 10 g DDL, then you will get forced correct check in DDL generated for Oracle 10 g and Oracle 11 g. Constraint of evil will be generated for Oracle 9i. You can move the constraint for Oracle 9i (in the check constraint dialog box) or generic if it can be treated as such constraint.

    I logged for DOF bad bug.

    Philippe

  • java.lang.ClassCastException:String cannot be cast to java.sql.Date

    I have a date component. MinValue named Id2 and the following code is to run a class cast exception indicating that the string value cannot be cast to a date sql

    java.sql.Date dateNeeded = (java.sql.Date) this.getId2 () .getValue ();

    can someone help me to overcome this problem.

    Thanks and greetings
    Janak

    Published by: new_to_ORACLE on February 18, 2011 16:56

    Published by: new_to_ORACLE on February 18, 2011 16:58

    the Date attribute is of type object oracle.jbo.domain.Date
    so, first try to cast to oracle.jbo.domain.Date. then to java.sql.Date object

    If you need to cast to another Date object, see this site:
    http://www.ecotronics.ch/webdesign/javadate.htm

    Published by: M.Jabr on February 19, 2011 11:53

  • pl sql sentence question

    I would like to find records with overlap. 1 GS_PRFM_INDEX_CODE can have 2 MD_ATTR_ID for the same period.
    Within this group of gs_prfm_index_code and md_attr_id, avoid duplication of time.

    Please find below the link to the image-

    http://LH3.ggpht.com/_xL6eBqjW6Yo/TEMofNIHKXI/AAAAAAAABzo/6pcmrA60yjI/clip_image002.gif


    I want to filter overlap at the beginning of the record of pl sql date back...
    Please help me.

    Thank you.

    Hello

    Try this:

    WITH sample_table AS
    (
     select 'A' gsd, to_date('01/01/2005','DD/MM/YYYY') start_date, to_date('31/01/2005','DD/MM/YYYY') end_date from dual union all
     select 'A'    , to_date('01/01/2006','DD/MM/YYYY')           , to_date('31/07/2006','DD/MM/YYYY')          from dual union all
     select 'A'    , to_date('01/08/2006','DD/MM/YYYY')           , to_date('31/12/2006','DD/MM/YYYY')          from dual union all
     select 'A'    , to_date('01/11/2006','DD/MM/YYYY')           , to_date('31/12/2008','DD/MM/YYYY')          from dual
    )
    SELECT gsd, start_date, end_date
    FROM (
     SELECT gsd, start_date, end_date,
            lead(start_date) over(partition by gsd order by start_date) as next_start_date
     FROM sample_table
    )
    WHERE next_start_date BETWEEN start_date AND end_date
    ;
    

    Basically, the innermost query retrieves all columns and calculation date compared to the current beginning of the next record. The outermost query then performs the filtering.
    The PARTITION BY clause in the LEAD function ensures that the 'next' record will have the GSD and the current. If you do not need the results of partition by GSD, you can remove it.

  • Database and SQL (data logger)

    Hi all

    I made the database (see photo) to save my data.

    Now I want to connect to this database in SQL, but found no example of it on the forum; I read some tutorials but I am little confused with UDL...  Second question is where these data are stored on my PC (mdb file)

    Thank you.


  • How to get an array of SQL data

    Hello

    I need to get a say DBMS output output of a SQL SELECT query say * OF EMP in the form of a table (with borders and titles).

    Is this possible in Oracle to return a table with borders and titles?

    user13410062 wrote:

    Hi all

    I don't know what am I missing in my question, which is confusing. The only thing I'm looking for is invoking a procedure/function of TOAD/SQLPLUS that can turn a TABLE formatting based on a query (SELECT * from insert_table where insert_table is-)
    CREATE TABLE insert_table
    (
    Number of S_No
    Varchar2 (128) of the player.
    Number of Ranking_Points
    Country varchar2 (128)
    );
    Now the output is visible in the result of the query or DBMS_OUTPUT as

    >> > >

    S_NO PLAYERNAME RANKING_POINTS COUNTRY
    1 Rafael Nadal 12390 Spain
    2 Roger Federer 7965 Switzerland
    3 Novak Djokovic 7880 Serbia

    To add to what anton said...

    When you submit a SQL query to the database, the statement is executed and the data is returned to the calling program.  The database has no awareness of what this program is, or how this program can restore the data on the screen, and the database itself is not any output device to display data.

    Thus, the data can be returned to various programs for example

    SQL * Plus - a terminal/command line screen, which usually uses a font to fixed width and standard characterset

    TOAD - a windows based application that has a "data grid" to display the data, you get

    SQL * Developer - windows-based application

    Oracle APEX - one based on web front end that makes HTML given to it, or can take the data and rendered in the HTML form for you.

    PowerBuilder - an application environment that could choose to display the data in DataWindow, store the data in data warehouses, be an intermediary providing data as a web service or be rendered web pages with data, etc..

    .NET - like PowerBuilder, it might choose to make the data are however required.

    Java - like Powerbuilder and .NET, it might choose to make the data are however required.

    etc.

    Thus, each of these environment renders data on the screen but he wants and will do it in a style that suits.  Some methods that work in an environment do not work in another environment, for example, you could provide data with the tab character included in the data and SQL * Plus can restore data with tags in it, but something like TOAD, perhaps will not and displays a character box indicating an "unprintable" character etc..

    That's why you can't just ask a question say you want to provide a query and get a table with headings etc. displayed, because the table with headings etc. depends entirely on the final user interface until you choose to use.

  • SNMP, generic SQL data loader, and built-in Port adapters

    Anyone have any success with using the SNMP (default MIB) and/or adapters third generic data SQL Loader?

    I'm under vCenter operations v5.7 VAPP and test the custom UI. I have installed the SNMP card, but when adding my own MIB they do not appear in the drop-down list when you try to add a new resource. I followed the docs to update the card with your own MIB files and everything is a - ok until I actually try to add a resource.

    I saw this KB:

    http://KB.VMware.com/selfservice/microsites/search.do?language=en_US & cmd = displayKC & externalId = 2034241

    But I loadded a few different mibs, poking around them in a mib browser, and each of them meet the requirements of that article.

    Regarding the SQL adapter. I add my instance of the adapter and the credentials and it tests fine, but when you add the resource to the environment overview screen, the 'Resource Type' dropdown is empty/non-editable. When I click ok, it of course gives me an error:

    The field 'type of Resrouce' is a required field. Please enter a value.

    Anyone who cross?

    Finally, there is documentation for the built-in Port Adapter? There is a very small excerpt in the card Guide:

    Reads a text that you set to determine the hosts and ports to monitor.

    But... where did you put this text?

    Two problems solved.

    First of all, the SNMP MIB has not picked up due to permissions on the file that I was transferred to the analytical VM. Duh. Evolution of the property of admin: admin corrects this problem. VMWare has taken this error.

    Also found a solution to the question SQL by clicking... the random button it appears that does not refresh the kind of resources until you run an auto-discovery. After crossing the Autodiscover queries, the drop-down list the type of resource is now available from the manual discovery. However, to make changes to the query/discovery files requires another automatic discovery for the changes to be picked up.

  • SQL Data Modeler

    Hi all

    I use sql schema from the schema generation datamodeller for my er. I generated on the guest design, but since I have 200 tables in design, it is not possible to print it, also when I create a PDF of it shows the file 200 KB but when I open it it is empty Adobe reader9.

    I want just the output I see in the designer in PDF or word format. Is it possible that I have to forward it to the development team.

    Thank you.

    Hello

    There is a forum for the tool space: SQL Developer Data Modeler

    Please mark this question as answered (so others know they can ignore it) and post again in the forum Data Modeler.

    Concerning

    Marcus

  • Use of domains in SQL data Developer MODEL

    Hello

    I'm trying to understand how to use areas of Oracle SQL Developer Data Modeler. We use version 3.1.3.  before I used Toad Modeler where the areas are just a part of your main design.

    Modeler data Oracle has a different concept.

    Suppose that I am working on 2 models: DesignA and DesignB which include relational models.

    DesignA and design B must use areas, but the list of areas in A design is very different from design B.

    Default domain file is located on drive c:, where SqlModeler is installed. It is of course unacceptable, so I need to change the default system Type directory in preferences.

    And of course, I want to have directories different area's of DESIGN and DESIGN B.

    So when I opened design has then I changed the default directory Type system we'll tell x:\AAA.   Then I close A design open design B and change the default directory of x:\BBB system Type

    I checked records AAA and BBB and they have required XML files here: defaultdomains.xml, defaultRFDBSSites and so on...

    Now the questions:

    can I rename defaultdomains.xls to something like AAAdomains.xls?  Domain administration can change any file with any name field, but how do I associate some file field with my design?  My wish, when I opened my design, and then the domain file will be automatically opened.  Is this possible?

    If I open 2 designs in Sql Modeler and switch between corresponding designs and domain files then need to be changed automatically as well.  Currently, I shouldn't forget to change the default system Type directory each time when I switch templates.  It is the only way to deal with?

    Thank you

    Vitaliy

    Vitaliy salvation,

    to see which domain files are used, the simplest is to go into the administration of the domain,

    Add new domain and then check the drop-down list for the property 'areas file' box - used files appears.

    Keep in mind that in defaultdomains.xml areas are still part of the domain that is used in the design. If this file must be empty (containing only 'unknown' domain) If you want to work

    with areas of level design.

    Philippe

  • effectiveness of the sql data warehouse and star/snowflake schema

    Hello

    We use 11.2.0.3 and need to improve the performance of queries for reports.  schema of data warehouse star/snowflake

    In addition to indexing, partitioning with star_transformation enabled etc I'm condisriing impact of the following on the performance of the queries.

    makes central (more than 1 billion lines) is associated with a client of dimesnion (a few hundred thousand lines) which in turn joined with the latest version of the dimesnion (includes approximately 30 000 lines).

    The table with a few hundred thousand lines (client dimesnion) alwsys must be questioned as stored data against the version of the customer at the time-, we wonder just latest_customer what users want to see

    the most recent version of the attributes of customer to stop data being fragemented through several lines in the report.

    If consideration would be more efficient to create a dimension that is equivalent to the customer but also stores the most recent version of the client attributes on the line-this means customer dimensuion many more columns but queries could would avoid additional research of this array of rank k 30.

    Thoughts are - it would be a material advantage?

    At the monent users request latest_customer to say would get all customers belonging to a certain multiple string.

    If change as above, then they would be interviewing the customer with a few hundred thousand lines dimension.

    Thoughts?

    Thank you

    Because a lot depends on the model of data access and data dissemination, we cannot really much more than only sb.  However, keep in mind Oracle accesses data by blocks (copies blocks and sometimes several blocks), in order to become more broad lines could have a paradoxical effect of not getting enough blocks in memory until you need it.

    It can help to visualize how data should be obtained (google something like visual sql and Karen Morton or Jonathan Lewis), as well as see the estimate and rowcounts actual imagined different plans.

  • Help query SQL Date!

    I'm trying to show the amount of time spent for each TVMREF for the week of October 3, 10 '-October 9, 10'. However, when the value of start_time begins before October 3, 10 ', or the end_time stops after October 9, 10 ', in other words, start_time and end_time span the specified week, the results don't return any time at all. I need to show the elapsed time for each TVMREF for the week in question. How to accomplish this seemingly impossible task?

    Example table:
    TVMREF ASSEMBLY START_DATE END_DATE
    700 0 30 - SEPT. - 10 30 - SEPT - 10
    700 0 30 - 7.-10 9 OCTOBER 10
    636 0 7 OCTOBER 10 OCTOBER 8, 10
    636 0 3 OCTOBER 10 OCTOBER 4, 10
    636 0 6 OCTOBER 10 OCTOBER 6, 10
    636 0 4 OCTOBER 10 OCTOBER 4, 10
    636 0 1 OCTOBER 10 1 OCTOBER 10
    635 0 3 OCTOBER 10 OCTOBER 3, 10
    635 0 OCTOBER 1, 10 2 OCTOBER 10
    635 0 1 OCTOBER 10 1 OCTOBER 10
    635 0 30 - 7.-10 1ER OCTOBER 10
    635 0 6 OCTOBER 10 OCTOBER 6, 10
    635 0 3 OCTOBER 10 OCTOBER 4, 10

    My query:
    with a (too)
    Select a.tvmref,
    trunc (86400 *(a.end_time-a.start_time)) seconds
    of reports.tvmdowntimes one
    where a.assembly = 0
    and a.start_time between October 3, 10 'and 9 October 10'
    and a.tvmref < = "800"
    order by 1)

    Select
    a.tvmref
    round (sum(seconds/60/60), 2) as hours
    a
    A.tvmref group
    order by 2 desc

    Not exactly what you need, but it looks like:

    with tvmdowntimes as (
                          select 700 tvmref,0 assembly,to_date('30-SEP-10','dd-mon-yy') start_time,to_date('30-SEP-10','dd-mon-yy') end_time from dual union all
                          select 700,0,to_date('30-SEP-10','dd-mon-yy'),to_date('09-OCT-10','dd-mon-yy') from dual union all
                          select 636,0,to_date('07-OCT-10','dd-mon-yy'),to_date('08-OCT-10','dd-mon-yy') from dual union all
                          select 636,0,to_date('03-OCT-10','dd-mon-yy'),to_date('04-OCT-10','dd-mon-yy') from dual union all
                          select 636,0,to_date('06-OCT-10','dd-mon-yy'),to_date('06-OCT-10','dd-mon-yy') from dual union all
                          select 636,0,to_date('04-OCT-10','dd-mon-yy'),to_date('04-OCT-10','dd-mon-yy') from dual union all
                          select 636,0,to_date('01-OCT-10','dd-mon-yy'),to_date('01-OCT-10','dd-mon-yy') from dual union all
                          select 635,0,to_date('03-OCT-10','dd-mon-yy'),to_date('03-OCT-10','dd-mon-yy') from dual union all
                          select 635,0,to_date('01-OCT-10','dd-mon-yy'),to_date('02-OCT-10','dd-mon-yy') from dual union all
                          select 635,0,to_date('01-OCT-10','dd-mon-yy'),to_date('01-OCT-10','dd-mon-yy') from dual union all
                          select 635,0,to_date('30-SEP-10','dd-mon-yy'),to_date('01-OCT-10','dd-mon-yy') from dual union all
                          select 635,0,to_date('06-OCT-10','dd-mon-yy'),to_date('06-OCT-10','dd-mon-yy') from dual union all
                          select 635,0,to_date('03-OCT-10','dd-mon-yy'),to_date('04-OCT-10','dd-mon-yy') from dual
                         )
    select  a.tvmref,
            sum(
                case
                  when a.start_time >= DATE'2010-10-03' and a.start_time <  DATE'2010-10-10'
                    then 86400*(a.end_time-a.start_time)
                end
               ) seconds
      from  tvmdowntimes a
      where a.assembly = 0
        and a.tvmref <= '800'
      group by a.tvmref
      order by 2 desc
    /
    
        TVMREF    SECONDS
    ---------- ----------
           700
           636     172800
           635      86400
    
    SQL> 
    

    SY.

Maybe you are looking for

  • How can I remove apps from my iPhone

    How can I remove apps from my iPhone 6 s?

  • Win8 upgraded to 8, 1 - is my warranty affected?

    I have a copy of thumb disk backup on my Win8 - but none on the Win8.1, so what do I do if I need to recover?     Don't have Pavilion Touch Screen Sleekbook - no DVD player - are there things like an external Dvd Player?

  • Binary indicator

    Hi all! I have a binary number, say 00000101. I would like to indicate that every bit of correspondent led on the front panel. So in this case, it'll be led0 and led2 on. How can I do?

  • Upgrade ram HP dv7 3133el

    Hello, I have a dv7 3133el, I have replace the HDD with a ssd, and now I want to increase the ram of 4 GB to 8 GB, wich type of ram I buy? Thank you

  • Windows 8 update does not restore backed up files

    Yesterday I when I joined PC it was just a white screen. I opted to update my windows 8 and had to back up my profile and files on an external hard drive (which took 2-3 hours) a then update the operating system. In the end, he informed me that he wa