Apex 4.2: really simple SQL date of issue

Hello

Anyone can get this SQL query with the correct date for Apex syntax?

Select * from table
where datecolumn > ' 2010-03-31'

I tried with #2010-03-31 #; I tried the dd-mm-yyyy; I tried the backslashes; I tried to use a date() function; and I tried cast() and I'm stumped.

As far as I remember, I put the global date format in dd-mm-yyyy.

The column that I need to analyze will finally be a timestamp with time zone column (for a plugin works).

However at this point, I can't do a simple working either date column, so it's just a problem of syntax newbie.

Help appreciated!

Thank you
Emma

Hi Emma,
because you use a literal string, you must specify the format;

select * from table
where datecolumn >to_date( '2010-03-31', 'YYYY-MM-DD')

Kofi

Tags: Database

Similar Questions

  • How to make this simple sql run faster?

    Here is a very simple sql, but it takes too long to finish as an hour or more, and the problem is in the table. It's a huge table with 17660025 lines.
    In addition, upd_dt is indexed.
    select distinct (dstn_type) from ims_ets_prty_msge where ims_ets_prty_msge.upd_dt > sysdate - 30;
    Execution plan seems to be no problem: (is 9i, and I do not think that it would not perform better if the UNIQUE HASH is used instead of SORT UNIQUE)
    -----------------------------------------------------------------------------------------
    | Id  | Operation                    |  Name                    | Rows  | Bytes | Cost  |
    -----------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT             |                          |     6 |    78 |  1409 |
    |   1 |  SORT UNIQUE                 |                          |     6 |    78 |  1409 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| IMS_ETS_PRTY_MSGE        |   856K|    10M|    10 |
    |*  3 |    INDEX RANGE SCAN          | IMS_ETS_PRTY_MSGE_INDX5  |   154K|       |     2 |
    -----------------------------------------------------------------------------------------
     
    Predicate Information (identified by operation id):
    ---------------------------------------------------
     
       3 - access("IMS_ETS_PRTY_MSGE"."UPD_DT">SYSDATE@!-30)
     
    Note: cpu costing is off
    Here is some info on the table
    NUM_ROWS BLOCKS  EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN
    17129540      455259     622           502             455278      188
    The thing is that we must make it run faster.
    And all I can think is to create a bitmap on dstn_type (low cardinality) index and partition the table using upd_dt;

    So my question would be is anyway that we can get a better response time without having to make that kind of change?
    Or is this kind of change really help?

    Any thoughts would be appreciated!

    Thank you

    Have you thought about putting an index on (upd_dt, dstn_type)?

    With the query you posted, and this index, it should be possible to use a full scan of the index, no visit to the table at all.

    A bitmap index would not be a good idea, if it is an OLTP application / table.

  • Is there a way to get a 'default' DataTemplate based on a simple sql query?

    Hi all

    I wonder if there is a way to produce a default value of the DataTemplate (or at least the dataStructure of the model portion).

    I like to call a trigger beforeReport to fill in the data for the report as such, I have to use dataTemplate instead of a simple SQL query, "select * from table_name". I have more than 50 columns on the report so I was hoping that I could not manually built a dataTemplate (or at less the part of dataStructure) for each report just be able to call a trigger.

    Thanks in advance for your ideas.
    Kind regards
    Yahya

    You need not define the cases you need the xml structure to be automatically decided by BEEP.

    
         
              
              
         
         
              
                   
              
         
    
    

    This datatemplate allows you to get the following structure

    
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    
    
    ..
    ..
    
    
    /LIST_ROW>
    
    
  • 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

  • How to do really simple things? tool change, set color etc.

    Hi all

    I tried to do a color picker. I managed to make it work with a user interface and all the sweet looks, but I have no idea how to actually do something! Photoshop, he's throwing very well.

    Really simple things:

    1. How do you define the pipette tool? (I already have working code that detects when the mouse moves outside the window)

    2. How do you define the color? Looking as setColor() function so that the current color, and the user can preview the result (i.e. color overlay)

    For me, seems like these two would be a simple of liners, but I can not for the love of God understand how do!

    However, documentation for JS is pretty good, but I was not able to run my swatches JS code. Here's my attempt att runs javascript code:

    bool runJavascript (const char * jscode)

    {

    Validation test

    If (sSPBasic is nil)

    {

    NSLog (@"sSPBasic is NULL");

    Returns false;

    }

    ASErr err = 0;

    JSScriptingSuite2 * sScriptingSuite = NULL;

    ERR = sSPBasic-> AcquireSuite (kJSScriptingSuite, kJSScriptingSuiteVersion2, (const void *) & sScriptingSuite);

    If (sScriptingSuite == NULL) //Also support Photoshop CS4 CS1 and items 6-10

    ERR = sSPBasic-> AcquireSuite (kJSScriptingSuite, kJSScriptingSuiteVersion1, (const void *) & sScriptingSuite);

    If (sScriptingSuite == NULL) return false;

    JSEngineRef engineRef = NULL;

    ERR = sScriptingSuite-> CreateEngine (& engineRef);

    If (err is kSPNoError)

    {

    Ascii to unicode conversion

    wchar_t * wcode;

    size_t codelength is strlen (jscode) + 1;.

    wCode = (wchar_t *) malloc (codelength * sizeof (wchar_t));

    mbstowcs (wcode, jscode, codelength);

    const ASUnicode * result = NULL;

    ERR = sScriptingSuite-> ExecuteScript (engineRef, (ASUnicode *) wcode, kJSExecutionModeNoDebug, & result);

    If (err! = kSPNoError)

    {

    NSLog (@"error (%d) JavaScript.) ("Script: %s ', (int) * result, jscode);

    }

    on the other

    {

    NSLog (@"JavaScript OK!");

    }

    Free (wCode);

    }

    on the other

    {

    Returns false;

    }

    If (engineRef)

    {

    sScriptingSuite-> DeleteEngine (engineRef);

    }

    Returns true;

    }

    Which doesn't really work. It seems that the culprit is the conversion of char * in ASUnicode. In the example they had

    const ASUnicode test [] = {'a', 'l', 'e', 'r', 't', ' (','------", 'h', 'i', ' \", ' ') ' ', ', ';', 0};

    which works very well. But apparently I don't convert my string to ASUnicode the correct way. Ideas or comments are much appreciated!

    CBC char [1024] = "alert ('Hello dissolve')";
    ASZString newZString;
    ASUnicode script [1024];
    sASZString-> MakeFromCString (src, strlen (src) + 1, & newZString);
    sASZString-> AsUnicodeCString (newZString, script, strlen (src) + 1, false);
    const ASUnicode * result;
    sScripting-> ExecuteScript (engineRef, script, kJSExecutionModeNoDebug, & result);
    sScripting-> DeleteEngine (engineRef);
    sASZString-> Release (newZString);
  • 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

  • Output is not as expected (getting wrapped) for a simple sql script

    Hello

    I try to run a simple sql script with a few queries including a semi colon output (;) when text file separated that later - I can open in excel.

    My SQL file contains in part the code - below

    SELECT
    "PORTFOLIO" | « ; » ||
    "CONTRACT # | « ; » ||
    "CONS_INV #" | « ; » ||
    "CUSTOMER #" | « ; » ||
    "CLIENT_NAME | « ; » ||
    'MESSAGE ' | « ; » ||
    "REQUEST_ID" | « ; » ||
    "BILL_TO_COUNTRY" | « ; » ||
    "BILL_TO_ADDRESS1" | « ; » ||
    "BILL_TO_ADDRESS2" | « ; » ||
    "BILL_TO_ADDRESS3" | « ; » ||
    "BILL_TO_ADDRESS4" | « ; » ||
    "BILL_TO_CITY" | « ; » ||
    "BILL_TO_POSTAL_CODE" | « ; » ||
    "BILL_TO_STATE" | « ; » ||
    "BILL_TO_PROVINCE" | « ; » ||
    "BILL_TO_COUNTY" | « ; » ||
    "SHIP_TO_COUNTRY | « ; » ||
    "SHIP_TO_ADDRESS1" | « ; » ||
    "SHIP_TO_ADDRESS2" | « ; » ||
    "SHIP_TO_ADDRESS3" | « ; » ||
    "SHIP_TO_ADDRESS4" | « ; » ||
    "SHIP_TO_CITY" | « ; » ||
    "SHIP_TO_POSTAL_CODE" | « ; » ||
    "SHIP_TO_STATE | « ; » ||
    "SHIP_TO_PROVINCE" | « ; » ||
    "SHIP_TO_COUNTY" | « ; » ||
    "INVOICE_DATE | « ; » ||
    "INVOICE_CREATION_DATE" | « ; » ||
    "PARTIALLY_DROPPED" | « ; » ||
    "AMOUNT".
    OF the double
    /
    SELECT "DOUBLE
    /
    SELECT "error Code" | « ; » ||' Error message "OF the DOUBLE
    /

    SELECT lookup_code. « ; » || Description
    OF fnd_lookup_values
    WHERE lookup_type = 'CUST_ERROR. '
    /

    The issue I'm facing is that the output of the competitive program file comes out bit so enter each line only 132 characters in a line and therefore gets pushed in the next row in excel.

    Output-

    PORTFOLIO; CONTRACT #; CONS_INV #; CUSTOMER #; CLIENT_NAME; MESSAGE; REQUEST_ID; BILL_TO_COUNTRY; BILL_TO_ADDRESS1; BILL_TO_ADDRESS2; BILL_TO_A
    DDRESS3; BILL_TO_ADDRESS4; BILL_TO_CITY; BILL_TO_POSTAL_CODE; BILL_TO_STATE; BILL_TO_PROVINCE; BILL_TO_COUNTY; SHIP_TO_COUNTRY; SHIP_TO_ADDR
    ESS1; SHIP_TO_ADDRESS2; SHIP_TO_ADDRESS3; SHIP_TO_ADDRESS4; SHIP_TO_CITY; SHIP_TO_POSTAL_CODE; SHIP_TO_STATE; SHIP_TO_PROVINCE; SHIP_TO_COUN
    TY; INVOICE_DATE; INVOICE_CREATION_DATE; PARTIALLY_DROPPED; AMOUNT


    Please advice on all of the commands that I can use in the script sql in order to expand the output page or any other workaround solutions!
    Please answer as soon as possible if you can help me!

    Thank you!

    SQL * MORE?

    SQL> set lin 1000
    SQL> spool your_file_out.csv
    SQL> your_query
    SQL> spool off
    

    Kind regards
    Malakshinov Sayan

  • 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

  • Store data related issues.

    Hello

    I am new to ODI. I have a couple of store data related issues. In fact, I am facing some problems, so I would like to have clarification.

    1. I imported the definition of a database table in a model. Later, I added a few columns to the database table. However, after having overthrown the model the new columns did not appear as a column in the data store. When I click on view the data, I could see the new columns. I expect that the new columns should have been displayed in the model tree.

    2. the key constraints have been defined in the database schema before reversing the model. However, these do not appear in the model. However, primary key constraints are listed.
    2A. I manually created the FK constraints in the model. On the definition tab, I gave the same name as it appears on the database. Also, I chose the type of the constraint as a reference database. And I checked activate on the database check box. These three steps are correct? The columns tab was completed as one might expect.

    These questions really (1 and 2), or am I missing a step? If I miss the point 2, to create the FK constraints manually, are my steps like 2 correct?

    I use ODI 10.1.3.5 and Oracle 11 g 2.

    Thanks in advance,

    Maury.

    Yes. You can install ODI 11 g at the same time at ODI 10 g.

  • Really Simple Date conversion function... but does not work

    For my application, I need a function that converts a date in a date that is a Monday.

    I wrote this simple function and I tried for many times... but it just doesn't work. It returns a null value. The problem lies in the IF statement.

    I'm using iSQL 9
    CREATE OR REPLACE FUNCTION to_monday ( datum IN DATE )
      RETURN DATE
      AS
    BEGIN
      FOR n IN 0..6 LOOP
        IF ( TO_CHAR(datum + n, 'day') = 'friday' ) THEN
          RETURN (datum + n - 4);
        END IF;
      END LOOP;
    END;
    SELECT to_monday(CURRENT_DATE) FROM dual;
    Published by: popovitsj on 2012-mrt-11 05:07

    Published by: popovitsj on 2012-mrt-11 05:09

    Published by: popovitsj on 2012-mrt-11 05:09

    Published by: popovitsj on 2012-mrt-11 05:12

    It is already available.

    SQL> select next_day(sysdate,'monday') a from dual;
    
    A
    ---------
    12-MAR-12
    
  • Scatterplot apEx 3.2 only display of data point unique series 2 +.

    I have a very basic question based on a very basic graphic.
    Currently I have a graphical configuration of clouds of points with 2 sets.

    Series 1 displays as expected, however series 2 displays only the last line retrieved by sql, it comes out.

    Example sql for each series is as follows

    series 1
    Select the null link, name, locationX and locationY
    of 'TEST '. "" USER_HISTORY ".
    where user = "test1".

    Series 2
    Select the null link, name, locationX and locationY
    of 'TEST '. "" USER_HISTORY ".
    where user = 'test2 '.


    All statements will work perfectly in sql and return a number of records of each.
    The strange thing is that if I change from series 2 to be the same query as series 1, but adds something to x and y cordinates it works fine.
    I print in series 2, but also of series 1.

    Select the link null, name, locationX + 10, + 10 locationY
    of 'TEST '. "" USER_HISTORY ".
    where user = 'test '.

    I hope that the problem is a simple lack of understanding in my name, as I am very new to the ApEx.

    Any help would be appreciated.

    Hello

    I think that there is a bug somewhere.

    I created a table called LOCATIONS using your data and assigned a THE_NAME column to A or B (alternately through your records). If I then create a chart point cloud using two series--one for A and a b - BUT use THE_NAME as the value of the LABEL, I get only a single value of the second series. However, if I add a unique ID on the table and adds it to the value THE_NAME (THE_NAME |) To_char (ID)), I get the full data on the list: [http://apex.oracle.com/pls/otn/f?p=40629:7]

    So it would seem that the LABEL values must be unique - this is the case in your actual data?

    Andy

  • SQL: convert varchar in Silver (asp, vb, sql) data type

    Hello

    I'm doing a simple search form that takes a value priced max investment to a text field in a form that is then transmitted to a catalog page. On this page, I have a select query that includes a where clause condition for less than the value of the query string.

    A simplified version of the query is:

    «SELECT * from table when price < 'varPrice' "»

    When I run the present I get an error saying

    Microsoft OLE DB provider for ODBC (0x80040E14) drivers
    [Microsoft] [ODBC SQL Server driver] [SQL Server] Implicit conversion of the varchar data type money is not allowed. Use the CONVERT function to run this query.

    I googled this a fair bit and can't really find what I need to get started me - anyone able to point me in the right direction?

    Thank you very much

    You compare prices (money) to "varPrice' (text) and implicitly
    conversion between these two types is not allowed. You must explicitly
    CAST or CONVERT the column.

    In your case, I guess you don't really means for varPrice text. Lose
    the quotes and it will address a number.

    "tedstar" wrote in message
    News:eggr3h$old$1@forums. Macromedia.com...
    > "SELECT * from table where price»< 'varprice'="">

  • Really simple question, function and scroll stop bar does not work

    I worked on different parts of this VI separately, when I put it together the scroll bar and stop working stopped button.

    In the individual VI, both are in the while loop. In the end, I was a scroll bar and a stop to apply every 5 while loops.

    I tried to take the helm of scrolling in and out of the first loop to attach to the rest, but it still doesn't work.

    I'm sure that there is a simple answer that is really stupid, but I played with him for a while.

    I have attached the VI am I train both to false data (in order to test the colored boxes).

    Thank you!

    You have a typical problem of beginner because of the lack of understanding of data flow. Run the code using execution highlighting, and look at the diagram to see.

    1. Your stop is outside any loop and so will be read only by the code only once at the beginning of the program.
    2. Your scroll bar is read in the first loop. All the other loops cannot begin until the first loop finished and since (1) is true, it will never happen if the value Boolean false when the code begins.

    Why do you have so much code duplication? 95% of the code for the loop is the same and can be reused. I don't know that the whole thing could be written using 5% of the total code. Put everything in a loop, iterate over the table 2D to get all values. Don't forget to put a little wait inside the while loop.

Maybe you are looking for