Dates and dynamic queries

Hi.
I am retrieving Entity EJBs using dynamic queries.
I had some troubles working with dates.
This is an example about the kind of query I am talking about:
SELECT OBJECT(a) FROM Payment AS a WHERE a.date <= '2/3/2005'
It worked prefectly fine in development environment.
So far so good, but finally it did not work properly in production.
I think the reason is that date format configuration is different (after all, all other queries without any date parameter works fine).
How can I set date format for Weblogic Server 8.1?
Or maybe some other idea about what is going on?
Thanks in advance
Oscar

I'd use a java.sql.PreparedStatement and let it worry about properly escaping that Date. I'd also be leery of returning a ResultSet. That's a database cursor, a scarce resource. Better to load the result of your query into a data structure and close the ResultSet right away.
String sql = "SELECT * FROM purchasedTransaction "
                  + "WHERE "
                  + "transactionDate >= ? AND transactionDate <= ?";
PreparedStatement statement = connection.prepareStatement(sql);
statement.setDate(1, theDateFrom);
statement.setDate(2, theDateTo);
ResultSet result = statement.executeQuery();
while (result.next())
// load your query into a data structure of some kind and return that.
result.close();
statement.close();Returning a CachedRowSet would be better than a ResultSet:
http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html
MOD

Similar Messages

  • Data series / dynamic queries

    Hi,
    I've got the following problem:
    I want to create a stacked bar chart based on dynamic queries. The query I use for the first series is:
    select null link, kw label, sum (volume) value from testview
    where id = to_number(:P18_ID)
    group by kw
    order by kw
    P18_ID is an input field.
    The query works fine and the chart is also ok.
    But if I use this same query for a second series I get an empty svg canvas as result. Even worse: no matter what kind of query I use for the second series I never get a result unless I take the variable P18_ID away from the first query.
    For info: the view testview is based on a table created by a pl/sql function (using pipelined output).
    Any ideas. I really would appreciate a quick answer very much because this is part of a project and we are running out of time because of this error.
    Thanks.

    Hi Andy,
    first of all: thank you very much for your efforts.
    I've tried something like you said before and yes, it works (at least most of the times). The problem is I want to have the option 'show all'. That's why I can't use a' where' clause (because I can't work with 'like ...%' for it would sometimes give wrong results because of ids with the same prefix -> or am I wrong?)
    What I mean is:
    where id like '1'% -> results for item 1 (and 10,11,12,...)
    where id like ' '% -> results for all items
    That's why I want to use a pl/sql function. The function is tested and works fine. But if I try to call it form ApEx it works only if use constants instead of variables or if I have only one series.
    Is there something like a time limit? Like ApEx stops processing if the database isn't answering as fast as expected (because a function is slower than querying a table). I don't really think that could be the answer because it's very little data and I'm using a pipelined function... but perhaps...

  • Templates and Dynamic Memory Allocation Templates

    Hi , I was reading a detailed article about templates and I came across the following paragraph
    template<class T, size_t N>
    class Stack
    T data[N]; // Fixed capacity is N
    size_t count;
    public:
    void push(const T& t);
    };"You must provide a compile-time constant value for the parameter N when you request an instance of this template, such as *Stack<int, 100> myFixedStack;*
    Because the value of N is known at compile time, the underlying array (data) can be placed on the run time stack instead of on the free store.
    This can improve runtime performance by avoiding the overhead associated with dynamic memory allocation.
    Now in the above paragraph what does
    "This can improve runtime performance by avoiding the overhead associated with dynamic memory allocation." mean ?? What does template over head mean ??
    I am a bit puzzled and i would really appreciate it if some one could explain to me what this sentence means thanks...

    The run-time memory model of a C or C++ program consists of statically allocated data, automatically allocated data, and dynamically allocated data.
    Data objects (e.g. variables) declared at namespace scope (which includes global scope) are statically allocated. Data objects local to a function that are declared static are also statically allocated. Static allocation means the storage for the data is available when the program is loaded, even before it begins to run. The data remains allocated until after the program exits.
    Data objects local to a function that are not declared static are automatically allocated when the function starts to run. Example:
    int foo() { int i; ... } Variable i does not exist until function foo begins to run, at which time space for it appears automatically. Each new invocation of foo gets its own location for i independent of other invocations of foo. Automatic allocation is usually referred to as stack allocation, since that is the usual implementation method: an area of storage that works like a stack, referenced by a dedicated machine register. Allocating the automatic data consists of adding (or subtracting) a value to the stack register. Popping the stack involves only subtracting (or adding) a value to the stack register. When the function exits, the stack is popped, releasing storage for all its automatic data.
    Dynamically allocated storage is acquired by an explicit use of a new-expression, or a call to an allocation function like malloc(). Example:
    int* ip = new int[100]; // allocate space for 100 integers
    double* id = (double*)malloc(100*sizeof(double)); // allocate space for 100 doublesDynamic storage is not released until you release it explicitly via a delete-expression or a call to free(). Managing the "heap", the area from where dynamic storage is acquired, and to which it is released, can be quite time-consuming.
    Your example of a Stack class (not to be confused with the program stack that is part of the C or C++ implementation) uses a fixed-size (that is, fixed at the point of template instance creation) automatically-allocated array to act as a stack data type. It has the advantage of taking zero time to allocate and release the space for the array. It has the disadvantages of any fixed-size array: it can waste space, or result in a program failure when you try to put N+1 objects into it, and it cannot be re-sized once created.

  • How to insert data into datagrid dynamically and also programatically with data and column names being retrived from a xml file..

    iam not able to insert data into datagrid corresponding to the column names..as iam inserting both data and column names programatically..ie iam not able to co relate the data with the column names.plzzz help me asap

    A DataGrid is row-based rather than cell-based with each row
    corresponding to an item in an underlying collection (specified in the
    dataProvider property). In order to add data to a DataGrid you
    manipulate the underlying collection, rather than the grid directly.
    Based on the limited description of your problem I would imagine you
    would need to create dynamic objects with property names that correspond
    to the dataFields of your dynamically created datagrid columns.
    So if you had created columns with dataFields "alpha", "beta" and
    "gamma" on your datagrid, you could create an item in your grid by
    adding the following object to your dataProvider:
    var gridItem : Object = new Object();
    gridItem.alpha = "alphaValue";
    gridItem.beta = "betaValue";
    gridItem.gamma = "gammaValue";

  • Spry:Content and Dynamic Spry Data

    Is there a way to get the spry:content attribute to work well
    with dynamic data generated from PHP/MySQL? I have read the
    progressive enhancement article and I am totally lost on it.
    The provided examples in the documentation deal with static
    data but there are so example of using spry:content and dynamic
    data.
    Can anyone help?
    Thanks

    Hi Arnout
    These are the urls:
    http://www.grafikkaos.co.uk/pages/front/test_home.php
    - this one displays the spry:content properly, but in the source,
    it does not show the 5 articles.
    http://www.grafikkaos.co.uk/pages/front/test_home_2.php
    - I applied a PHP repeat region here. In the source, it shows 5
    articles being shown but on page view, each title and date is
    repeated 5 times.
    Any ideas?
    Thanks

  • IP: Dynamic Data and Lead Columns

    Hello,
    In IP, there is not such thing as "Dynamic Data and Lead Columns" which we have used successfully in BPS. We have quite normal case where accounts are on rows and columns are defined as follows:
    Column 1): KF Qty1, Period #, Year "Var Current year (single value)"
    Columns 2-n): KF Amt1, Period "Var periods current year (multiple values)", Year "Var Current year"
    Column n+1): Sum columns 2-n
    Number of periods in variable "Var periods current year" is not fixed and maintained by superuser, so number of columns is somewhere between 3 and 14 (at least one open period, maximum 12, plus the Qty1 and Sum columns).
    How would you fix this in IP?
    Thanks for answers!
    Aki

    Hello Aki,
    you could put the period into the columns as char.
    if you make a selection to value # and the variable you will se as many columns as periods are selected in the variable plus the one column for #.
    regards
    Cornelia

  • How to display dynamic datas and double datas (chart)

    Hi all !
    I would like to display dynamic datas and double datas by using charts.
    However, it doesn't work and I don't understand why.
    Can you help me to fix that ?
    Best regards,
    - John
    Attachments:
    double_dynamics_data.vi ‏54 KB

    Hi John,
    the sine looks like it should look with your VI!
    You convert the DDT to a scalar DBL. That conversion will only use the first sample of the generated sine waveform - usually this is always the same (offset) value when you generate full periods… Or to put it in a mathematical expression: sin(0°)+4 = 4!
    When you want to display waveform you should work with waveforms!
    Actually, I have used Dynamic data type in order to simulate an signal.
    Well, I also simulated a signal in my example VI. I didn't use any ExpressVI to do so…
    In a few weeks, I will receive a sensor. I will use in LabView 'DAQ Assistant' whose the ouput is a Dynamic Data.
    Nobody forces you to use the DAQAssistent ExpressVI. There are nice DAQmx functions available and LabVIEW comes with a lot of ready-to-use example VIs…
    That's why, I used in first place, the 'Simulate signal'. So I think I should keep Dynamic Data Type
    I do think you don't need to use the DDT. I think it's better to understand what is going on in your VI. And I think the DDT will be no help for you…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Custom Map in flash using XML data for dynamic map and point of intrest loading...

    Been some time since I have used Flash for anything...
    I'm working on a little project to dynamically build a map
    and set points of interest on the map. At this time I have the
    (mySQL) data being queried and formatted with PHP and pushing the
    data to Flash as XML.
    In starting the project I'm a bit lost... I mean I have my
    data and a good XML format but as it is I'm lost on parsing the
    data in Flash and assigning its values to movie clips or other...
    I've looked at the Loader Component and the XML Connector
    Component and find I can get that to work at all...
    My second though was to create a single movie clip on stage
    and give it an instance name of "Background" and have it load the
    URL of an image given in the attached XML doc... Node "a_zone" and
    the value given to attribute "image"... But this brings me back to
    square one of not quite understanding Flash and parsing XML... With
    this second idea I would use AS to create a movie clip, set it's X
    & Y cords and load an image to it based on the XML attributes
    listed in the "Gatherable" node (one for each node).
    Any suggestions, examples or related info is welcome...
    Thanks in advance!

    Okay, that really wasn't what I was looking for... But I did
    go back and RTM :-)
    Here's what I have... 1st frame:
    2nd Layer: movieclip with the instance name "currentPicture"
    The image loads into "currentPicture" from the URL given in
    the XML "a_zone" node attribute "image" just fine....
    But I'm not able to grab the attributes of each "Gatherable"
    node it seems... am I missing something or just not pointing to the
    right node?
    I keep getting:
    undefined
    undefined
    undefined
    Error opening URL
    "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"
    Error opening URL
    "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"
    Error opening URL
    "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"

  • Data discrapancy between queries in SAP and BW

    Hi All,
    I have a problem in data discrapancy between the queries in SAP R/3 and BW Queries .can any one please tell me how to investigate this kind of problems and how to fetch this data ,
    please help me ASAP this is an urgent issue
    and how many ways we can investigate this kind of issues ,please send me some steps .......
    Thanks
    Tom

    Hi Tom,
    You can proceed in a step by step fashion when trying to match the BW query data with that in R/3 reports.
    . Try to check the filters and calculations applied in the BW query. You can create a very basic query if required.
    . If this does not work then try using transaction LISTCUBE so that you can directly see the data in the InfoCube as per your chosen selections.
    . If this doesn't yield anything, then look at the way data is being processed: Any code in the Start routines, Update or Transfer rules. Check them for correctness.
    . If you loaded through the PSA, you can also check data in the PSA. Or you can also check the data extracted using RSA3 in the R/3 system.
    . Try to provide us some more specifics about the data that you are trying to match. Which module is it? Which is the datasource?
    Hope this helps...

  • Dynamic pdf up to 200 images, the size of pdf is larger, cannot save data and images to the form

    Hi all,
    My client would like to dynamic images up to 200 pictures to my forms. It is working fine. However, when I add images up to 35 images. I could not add images to the form any more. Then, I save data on the form. All images and data typed on the form are disappeared. I don't know reason.
    If I only add 10 images - I can save data and images on the form. The size of pdf is 15456 kb.  I was unable to  add more pictures or data on the form.
    Maybe there are problem the size of pdf? How much size can an dynamic pdf  limited?
    Can we save the information and images as much as we want?
    I have spent 2 weeks to work and try to figure out this problem. However it is not successful.
    Please help,
    Cindy

    You should ensure, that your users do not import big images.
    Therefore you can use a script on the change event of an image field which checks the data size and warns the user if the file is too big.
    function formatNumber(number) {
        var num = number + '',
        x = num.split('.'),
        x1 = x[0],
        x2 = x.length > 1 ? '.' + x[1] : '',
        rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1)) {
            x1 = x1.replace(rgx, '$1' + ',' + '$2');
        return x1 + x2 + "KB";
    var sizeLimit = 200, //allow upto 200KB images
      thisSize = Math.round((this.value.oneOfChild.value.length * 3 / 4) / 1024);
    if (sizeLimit > 0) {
      if (thisSize > sizeLimit) {
      xfa.host.messageBox("Note: With " + formatNumber(thisSize) + " the size of the imported image is greater that the recommended maximum of " + formatNumber(sizeLimit) + ".\nLarge images can cause a insufficent performance.\n\nIf possible, use images with the following recommended specs:\nFormat:\t\tPNG or JPG\nColor depth:\t8 Bit (higher is not supported)\nColor space:\tRGB (CMYK is not supported)\nFile Size:\t\t" + formatNumber(sizeLimit), "Recommended image size exceeded", 3, 0);

  • [ASK] How to get system date and substring / concate in data manager dynami

    Hello guys.
    I want to run package DM with the input have default value.
    The selection is look like this :
    Dimension : CATEGORY
    Source : PLAN_2011
    Destination : FORECAST_2011
    Dimension : TIME
    Source : 2011.JAN,2011.FEB,2011.MAR,2011.APR,2011.MAY,2011.JUN,2011.JUL,2011.AUG,2011.SEP,2011.OCT,2011.NOV,2011.DEC
    Destination : <same>
    How to get system date year and do the substring / concate ?
    So dimension category source will be PLAN_<YYYY>, destination = FORECAST_<YYYY>
    Dimension source = <YYYY>.JAN,<YYYY>.FEB,<YYYY>.MAR,<YYYY>.APR,<YYYY>.MAY,<YYYY>.JUN,<YYYY>.JUL,<YYYY>.AUG,<YYYY>.SEP,<YYYY>.OCT,<YYYY>.NOV,<YYYY>.DEC
    Depend on year system date.
    Thank you.

    Stuart,How are you storing OnSaleDate. If you are using OnSaleDate as an attribute dimension then you can write a Custom Defined Function to either:1- query your system for the current date and return the number of seconds that have elapsed since 1/1/1970. This is by definition the begining of the Epoch and how Essbase treats Attribute Dimensions of the Date type.public static long getDateInSeconds() {           Calendar cal = Calendar.getInstance();           return cal.getTime().getTime()/1000;}2- Write a Custom Defined Function that will accept the OnSaleDate and return the number of days sincepublic static double daysSince(double myDate) {     return (getDateInSeconds()-myDate )/86400;}

  • Date choosers and dynamic email creation with table

    I’m an experienced Director/Shockwave programmer but a
    relative novice at Flash/AS3. I’ve just been asked to provide
    a quote to convert part of an old project from Director to Flash
    (web delivery). The part to be converted is very similar to a
    reservation system but without the need for data lookup or storage;
    it requires the user to choose a date (using a date chooser
    component), collects some additional information, performs some
    calculations, then graphically displays 3 consecutive calendar
    months with a range of days highlighted. The user could then opt to
    email the results, behind the scenes my code wrote html to a string
    and attached the string to an email to recreate the results.
    The client was fussy about the data input, eg; requiring that
    users be able to input dates using either a date chooser or by
    typing the date, and that the unused method should update on focus
    change.
    So with all that said, I’ve found three date choosers.
    Does anyone know if one of these would be better suited to my needs
    than another? Also, the email requirement may go away, but does
    anyone have tricks in AS3 to do something similar to what I did
    with Lingo?
    AS3 Date Choosers:
    http://flashden.net/item/flash-calendar-strongdatestrong-chooser-as2-strongas3strong/4151
    http://www.flashden.net/item/as3-datechooser/10837
    http://flashden.net/item/flash-calendar-strongdatestrong-chooser-as2-strongas3strong/4151

    I’m an experienced Director/Shockwave programmer but a
    relative novice at Flash/AS3. I’ve just been asked to provide
    a quote to convert part of an old project from Director to Flash
    (web delivery). The part to be converted is very similar to a
    reservation system but without the need for data lookup or storage;
    it requires the user to choose a date (using a date chooser
    component), collects some additional information, performs some
    calculations, then graphically displays 3 consecutive calendar
    months with a range of days highlighted. The user could then opt to
    email the results, behind the scenes my code wrote html to a string
    and attached the string to an email to recreate the results.
    The client was fussy about the data input, eg; requiring that
    users be able to input dates using either a date chooser or by
    typing the date, and that the unused method should update on focus
    change.
    So with all that said, I’ve found three date choosers.
    Does anyone know if one of these would be better suited to my needs
    than another? Also, the email requirement may go away, but does
    anyone have tricks in AS3 to do something similar to what I did
    with Lingo?
    AS3 Date Choosers:
    http://flashden.net/item/flash-calendar-strongdatestrong-chooser-as2-strongas3strong/4151
    http://www.flashden.net/item/as3-datechooser/10837
    http://flashden.net/item/flash-calendar-strongdatestrong-chooser-as2-strongas3strong/4151

  • What are basic and dynamic disks?

    Basic disks and dynamic disks are two types of hard disk configurations in Windows. Most personal
    computers are configured as basic disks, which are the simplest to manage. Dynamic disks can make use of multiple hard disks within a computer to duplicate data for increased performance and reliability. 
    A basic disk uses primary partitions, extended partitions, and logical drives to organize
    data. A formatted partition is also called a volume (the terms volume and partition are often used interchangeably). In this version of Windows, basic disks can have either four primary partitions or three primary
    and one extended partition. The extended partition can contain an unlimited number of logical drives. The partitions on a basic disk cannot share or split data with other partitions. Each partition on a basic disk is a separate entity on the disk. 
    Convert  basic disk to dynamic disk: MiniTool Partition Wizard
    Dynamic disks can contain an unlimited number of dynamic volumes that function like the primary partitions used on basic disks. The main difference between basic disks and dynamic disks is that dynamic disks are
    able to split or share data among two or more dynamic hard disks on a computer. For example, a single dynamic volume may actually be made up of storage space on two separate hard disks. Also, dynamic disks can duplicate data among two or more hard disks to
    guard against the chance of a single disk failing. This capability requires more hard disks, but improves reliability.

    Hi Miningsu,
    The scope of this forum is to answer General queries related to File & Storage Services pertaining to Windows Server 2003, Windows Server 2008 / R2 and 2012 / R2 operating systems.
    This is not where you can give training to people. Kindly Co operate.
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/9ce53966-49bb-48fe-b195-2652ad8d09d9/purpose-of-this-forum-server-general-please-read-before-posting-?forum=winservergen
    Regards,
    Rafic
    If you found this post helpful, please give it a "Helpful" vote.
    If it answered your question, remember to mark it as an "Answer".
    This posting is provided "AS IS" with no warranties and confers no rights! Always test ANY suggestion in a test environment before implementing!

  • Dynamic queries

    I am trying to use "? parameter style" to execute dynamic queries at runtime on the view object. I was sucessful in using this for the rowsetInfo but i want to do this for a view object. I cant seem to call the new queries after i assign the new where clause to the VO using the whereClauseParams(). I am building an applet/application. Does anyone have any examples....( ie : oracle people)?

    I looked at the help-topics under creating and changing view object queries in the code....however how do i tie this into the view objects i already created using BC4J...Here is my code for example:
    ApplicationModule appmod = sessionInfo1.getApplicationModule();
    ViewObject vo = appmod.findViewObject("PARAMVIEW");
    vo.setWhereClause("MGR > 1000");
    vo.executeQuery();
    rowSetInfo1.executeQuery();
    ---this does not work!!!!
    this does however
    rowSetInfo1.setWhereClause("MGR > 1000");
    rowSetInfo1.executeQuery();
    i want to use the vo because i was told that the rowSetInfo.executeQuery runs on the client side (in Help- 'ABOUT Dynamic Clauses in Data Form'-->"...the addition of dynamic WHERE and ORDER BY clauses that execute on the data form *client*")while the vo.executeQuery on the server side...Does anyone know if this is true...and if this will improve performances in an applet or am i just waisting my time?
    thanks

  • Transpose Distinct Date and Use as Column name

    All,
    I am trying to transpose a distinct date and use it as a column name and list the data below it. My version of Oracle does not have the pivot function. Plus I am having trouble with figuring out how to alter the table name to the distinct date. Can someone provide me with logic that will dynamically take the current format (see below) and transpose it to the needed format (see below)?
    Current format:
    WEEK_END_DATE     RD     STORE_NUMBER     RANK
    09-19-2009     R0011     00505     6
    09-19-2009     R0028     00097     97
    09-19-2009     R0057     01801     72
    09-19-2009     R0061     04775     72
    09-19-2009     R0068     03920     66
    09-26-2009     R0011     00505     8
    09-26-2009     R0028     00097     50
    09-26-2009     R0057     01801     120
    09-26-2009     R0061     04775     30
    09-26-2009     R0068     03920     1
    nth date
    The format I need:
    RD     STORE_NUMBER     09-19-2009 09-26-2009 nth date....
    R0011     00505     6 8
    R0028     00097     97 50
    R0057     01801     72 120
    R0061     04775     72 30
    R0068     03920     66 1

    I apprreciate your help. I have tried to implement the dynamic pivot logic. I can create the correct case statement and change the column name to the name I need.
    However, when I try to use @@dynamic_pivot.sql I get the following error:
    ORA-04054: database link ORAEDW@DYNAMIC_PIVOT_SUBSCRIPT does not exist
    I have tried it three ways...
    @@dynamic_pivot
    and @@dynamic_pivot.sql
    and @@c:\dynamic_pivot_subscript.sql
    I don't have direct access to the database. I have to run my queries from toad. When I cut and paste the generated case statements, It works. I am just not able to dynamiclly insert those case statements into a select. Do you have any suggestion?
    -- ***** Start of dynamic_pivot.sql *****
    -- Suppress SQL*Plus features that interfere with raw output
    set feedback off;
    set heading off;
    SPOOL     c:\dynamic_pivot_subscript.sql
    SELECT
    DISTINCT',max(CASE WHEN week_end_date = '''|| week_end_date || ''' THEN rank END) AS '|| 'DATE_AS_OF_' ||
    to_char(week_end_date,'MM_DD_YYYY') AS case
    FROM
    test_ptw_bottom_10;
    SPOOL OFF
    -- Restore SQL*Plus features suppressed earlier
    What I need:
    SELECT     
    rd,
    store_number
    @@c:\dynamic_pivot_subscript.sql
    FROM     
    test_ptw_bottom_10
    where
    week_end_date in ('19-SEP-09','26-sep09')
    group by
    rd,store_number
    ORDER BY     
    rd;
    What works:
    SELECT     
    rd,
    store_number
    ,max(CASE WHEN week_end_date = '26-SEP-09' THEN rank END) AS DATE_AS_OF_09_26_2009
    ,max(CASE WHEN week_end_date = '19-SEP-09' THEN rank END) AS DATE_AS_OF_09_19_2009
    FROM     
    test_ptw_bottom_10
    where
    week_end_date in ('19-SEP-09','26-sep09')
    group by
    rd,store_number
    ORDER BY     
    rd;
    Edited by: user10609947 on Oct 5, 2009 2:36 PM
    Edited by: user10609947 on Oct 5, 2009 2:38 PM

Maybe you are looking for