Small Validation in sql Query Date range..

hi.
I need Some suggestions for validating the Date.
In customization form From date and to date i given.
like
01/08/2014 and 30/08/2014..
Second time if  they give...
i can validate like below
select  DocEntry from  [@PR_OTIMESHEET] where U_frmdate >='20140801' and U_todate <='20140830'
It's fine everything is fine. but.
if i give like from date 15/08/2014 and 30/08/2014 it should be validate and stop it..
if i run the  above query by replace the dates it is not working..
Simply.
Date is  200   to  300 if they give first time it will be save in db.
second time if i give 150 to 400 it should not accept bcz 150 all ready comes between 200 to 300
How can i restrict it.

Hi,
If your question is related to SDK, please post it there.
Thanks,
Gordon

Similar Messages

  • Is there a way to consolidate calculations used in SQL Query Data Sets?

    I am building SQL Query Data Sets against multiple DB Views which all have different date formats. I have the date parameter working well, but want to consolidate the changes that I have to do to it especially for the quarter. For example the SQL against a monthly view would use "where year_month > to_char(:ST_DATE, 'YYYY-MM')" which is not too hard, but to make that work for the quarterly view I need several concats and a decode to get a "> '2012-Q2'". I would like not to have to do this within every where clause. I had put this into a global element hoping to use that in a filter for the data set, but the filter does not have access to global elements only parameters.
    Is there any way to refer to a calculated global element from the data set to do this? I am using Layout Templates, so even if I wanted to I could not do the condition within the template.
         Thanks,
         Rick

    Change the following line to include the red coloured parts
    <div class="MasterColumn" spry:repeat="ds4" spry:setrow="ds4" spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">
      <span>{Dsp_#}</span><span>{Dsp_WkDay}</span><span>{Dsp_Event}</span>
    </div>
    The add the following style rule to your document:
    .MasterColumn span {
        display: inline-block;
    I hope this helps.
    Ben

  • With clause in SQL query data model

    Hello!
    isn't it possible to use the with clause in sql query data models?
    for example following query:
    WITH
    a_test as (
    select dummy from dual
    select *
    from a_test
    brings up a "XML Parsing Error: no element found"-error...
    BR Paul

    I tried a slightly different query (see below) and the query worked fine and retrieved data.. I did not get any errors.
    WITH
    a_test as (
    select 'dummy' from dual
    select *
    from a_test
    This works as well.. retrieving the value of the parameter
    WITH
    a_test as (
    select :Test_ID from dual
    select *
    from a_test
    thanks,
    BIPuser

  • SQL Concat function seem not to work properly in SQL query data model. BIP 11g

    I try to use this function to show entire name CONCAT(name, ' ', surname) and it doesnt show the surname. it looks like it only tooks 2 arguments. I use it with the option "Add element by expression" within a SQL Query - Data set.
    Lucia

    i don't believe you
    please post more info, may be screen or sql or some more useful statement
    CONCAT(name, ' ', surname) and it doesnt show the surname
    may be because for some case "surname" is empty  or may be you incorrect use concat function
    one way mentioned by BluShadow is " || " operator  - http://docs.oracle.com/cd/B28359_01/server.111/b28286/operators003.htm#SQLRF51156
    and another is concat function http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions026.htm#SQLRF00619
    so for your case it can be like
    CONCAT(CONCAT(name, ' '), surname)

  • Different LOV behavior between SQL query data model and data template

    I have noticed different behavior when using parameters linked to list of values (LOV) of type menu with the multiple selection option enabled and a SQL query data model vs a data template. Here's the example because that first sentence was probably really confusing.
    SQL Query:
    select
    plmc.MonthCode, plmc.ModalityDim, plmc.ModalityName,plmc.RegionDim
    from
    DataOut.dbo.PatientLabMonthlyCross plmc
    where
    plmc.MonthCode = 200202
    and plmc.RegionDim = 1209
    and 1 =
    case
    when coalesce(:modalityDim,null) is null
    then 1
    else
    case
    when plmc.ModalityDim in (:modalityDim)
    then 1
    else 0
    end
    end
    Putting BI Publisher into debug mode, defining a data model of type SQL Query, defining a parameter called :modalityDim linked to a LOV that allows multiple selections, and selecting a couple of values from the LOV the output of the prepared statement is:
    [081607_122647956][][STATEMENT] Sql Query : select
    plmc.MonthCode,
    plmc.ModalityDim,
    plmc.ModalityName,
    plmc.RegionDim
    from
    DataOut.dbo.PatientLabMonthlyCross plmc
    where
    plmc.MonthCode = 200202
    and plmc.RegionDim = 1209
    and 1 =
    case
    when coalesce(?,?,null) is null
    then 1
    else
    case
    when plmc.ModalityDim in (?,?)
    then 1
    else 0
    end
    end
    [081607_122647956][][STATEMENT] 1:6
    [081607_122647956][][STATEMENT] 2:7
    [081607_122647956][][STATEMENT] 3:6
    [081607_122647956][][STATEMENT] 4:7
    [081607_122654713][][EVENT] Data Generation Completed...
    [081607_122654713][][EVENT] Total Data Generation Time 7.0 seconds
    Note how the bind variable :modalityDim was changed into two parameters in the prepared statement.
    When I use this same SQL Query in a data template the output is:
    [081607_012113018][][STATEMENT] Sql Query : select
    plmc.MonthCode,
    plmc.ModalityDim,
    plmc.ModalityName,
    plmc.RegionDim
    from
    DataOut.dbo.PatientLabMonthlyCross plmc
    where
    plmc.MonthCode = 200202
    and plmc.RegionDim = 1209
    and 1 =
    case
    when coalesce(?,null) is null
    then 1
    else
    case
    when plmc.ModalityDim in (?)
    then 1
    else 0
    end
    end
    [081607_012113018][][STATEMENT] 1:'6','7'
    [081607_012113018][][STATEMENT] 2:'6','7'
    [081607_012113574][][EXCEPTION] java.sql.SQLException: Syntax error converting the nvarchar value ''6','7'' to a column of data type int.
    Note the exception because it is trying to convert the multiple parameter values.
    Am I doing something completely wrong here? I really need to use a data template because I will need to link a couple of queries together from different database vendors.
    -mark

    This is for 10.1.3.4 - because in 11g every SQL query is automatially part of a data model.
    In 10g SQL query is for simple unrelated SQL queries.
    If you need to use advance features such as:
    a) multiple SQL queries that are joined in master-detail relation ships
    b) before/after report triggers
    Then you will need to use the data template, which is an XML description
    of the queries, links, and PL/SQL calls.
    hope that helps,
    Klaus

  • Create a validation for SQL Query (updateable report)

    Hello
    I have a need for creating a validation on a SQL Query (updateable report)- type region
    1)
    When a row get populated i don't want same values to be populated in the second row.(as shown in first 2 rows)
    Also, I don't want to have a value that falls in range in between 100 and 1000 for the period falls in the previous. (as shown in third row)
    i.e
    Type_id
    Lower_Limit        Upper_Limit           Date_From       Date _To
    1
    100                      1000                   1/1/2013        12/31/2013
    2
    100                      1000                    1/1/2013        12/31/2013
    3
    101                       500                    2/1/2013        10/31/2013
    appreciate any help
    thanks
    kp

    This example could help:
    http://apex.oracle.com/pls/otn/f?p=31517:214
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • SQL Query Data Model Question

    Hi All,
    I'm new to XMLPublisher so i'll try to explain the best i can the problem i'm having creating a Data Model for my report.
    I'm using Database XE and have installed XMLPublisher, as XE is extremely flexible in creating apps i'm having huge trouble finding a reporting solution for my applicaiton. I have created an app to track and control time and expense which i want to generate timesheet, expense sheets, invoice etc from.
    Having done some read i think XML is the best approach for me however i'm having huge troubles with my data model.
    EXAMPLE:
    I have 2 tables to start with, first table holds client information and the second table holds project information. One client can have many projects.
    When i create the Data Model using SQL i get the obvious problem that when a client has more then one project my XML structure is incorrect.
    SELECT gc.name AS CLIENT,
    gp.name AS PROJECT
    FROM gte_client gc,
    gte_project gp
    WHERE gc.client_id = gp.client_id(+)
    The above SQL creates the following XML
    - <ROWSET>
    - <ROW>
    <NAME>Symatrix Ltd</NAME>
    <NAME>Symatrix Pre-Sales</NAME>
    </ROW>
    - <ROW>
    <NAME>Aston Carter</NAME>
    <NAME>MOD</NAME>
    </ROW>
    - <ROW>
    <NAME>Symatrix Ltd</NAME>
    <NAME>Fujitsu</NAME>
    </ROW>
    </ROWSET>
    Obvious problem here is the fact that client Symatrix appears twice as there are 2 projects.
    I have tried to write SQL/XML and i think i'm beginning to understand the structure of the XML functions however XMLPublisher doesn't appear to understand the syntax when creating a SQL Query for the data model.
    I hope all this makes sense.
    Kind Regards
    Glen

    Hi All,
    Ok, so with a little searching through documents and articles on the web i found this information.
    http://blogs.oracle.com/xmlpublisher/2006/05/05#a38
    this details the exact thing i'm trying to achieve so anyone else who searches this forum with a similar problem check this out.
    Regards
    Glen

  • Need help with sql query dates

    Hi,
    I have a sql query where i need to extract some info between given dates. The where clause of this query is as follows:
    WHERE CPD_BUS_UNIT=:ESI_PRM_1
    AND CPD_VOUCHER_DATE >= :P_DATE_FROM
    AND CPD_VOUCHER_DATE < (:P_DATE_TO+1)
    When i execute the query in toad, i can view the data but not the execution plan.It gives an error ORA-00932-Inconsistent Datatypes.
    But when i remove (+1) from :P_DATE_TO, i can c the execution plan and data. Will the data be different from the previous one.
    Please suggest how to rewrite the query.

    Can you please give it a try?
    WHERE CPD_BUS_UNIT=:ESI_PRM_1
    AND CPD_VOUCHER_DATE >= :to_date(P_DATE_FROM)
    AND CPD_VOUCHER_DATE < (to_date(:P_DATE_TO)+1) Regards

  • How to get sql query data and write into csv file?

    I am writing to seek help, in how can I create bat. script which can execute the following logic:
    connection to the database
    run sql query
    create CSV file
    output query data, into CSV file
    save the CSV file
    osql
    -S 84.18.111.111
    -U adw
    -P rem
    -i "c:\query.sql"
    send ""
    sed -e 's/,\s\+/,/g' MCI_04Dec2014.csv > localNoSpaces.csv
    -o "c:\MCI_04Dec2014.csv"
    This what i have so far, and I am little struggling with the logic after creating CSV file. I am unable to get the above script to work, please advice further, where I may be going wrong. 
    Can you create if statement logic within window's script, to check for null parameters or data feeds?
    Any hints would be most appreciated. 

    Thank you for your reply. 
    Apology for posting the code irrelevant to the forum, as I am still novice scripting user.  
    My goal is to create window's script which can compute the above logic and send the final output file (csv), to FTP folder. 
    Can this logic be implemented via bat. script, if so, is there a example or tutorial i could follow, in order to achieve my task. 
    Any help would be much appreciated. 

  • JSTL sql:query date field has zero time part

    I have a little JSP where I am using JSTL to do a query against a table "ph_application" that has a date field "rundate". This field has many different dates and times in it.
    Here is the code snippet:
    <sql:setDataSource url="jdbc:oracle:thin:@oraprd02:1521:ipp4" user="site" password="pmc_site"/>
    <sql:query var="application" sql="select * from ph_application"/>
    <c:forEach items="${application.rows}" var="row">
    <tr>
    <td><c:out value="${row.name}" default=" " escapeXml="false"/></td>
    <td><fmt:formatDate value="${row.rundate}" type="both"/></td>
    </tr>
    </c:forEach>
    The resulting date/time output always has a 12:00:00 AM time regardless of what is actually in the table. I have changed the fmt:formatDate to a c:out of the row.rundate.time value and it appears that the time part of the date is actually zero at this point.
    Is there an inconsistancy between the oracle date type and what JSTL is expecting (somewhere)?
    Any help and/or verification is appreciated.
    Richard

    I'm running this from within JDeveloper 10g.

  • BC4J List Validation from SQL Query, using parameters?

    When adding validation to a business component, one of the options for the list validation rule is 'Query Result'.
    is it possible to use parameters??. e.g. for a student type registration application
    validation on studentEntry that the course is availabe for the term entered would be like :-
    Select course from courseCat where term = :pterm
    where :pterm is the current term that the student has entered, this exists on the current studentEntry row.
    how would I code the parameter in the select statement in 'edit validation rule' screen?

    When adding validation to a business component, one of the options for the list validation rule is 'Query Result'.
    is it possible to use parameters??. e.g. for a student type registration application
    validation on studentEntry that the course is availabe for the term entered would be like :-
    Select course from courseCat where term = :pterm
    where :pterm is the current term that the student has entered, this exists on the current studentEntry row.
    how would I code the parameter in the select statement in 'edit validation rule' screen? This is currently not available on the built in validators. However you can create a custom-validation rule and perform such bind params and execute queries. We do have plans to support named paramters in queries that will allow us to enable this feature on validators as well.

  • Finding the last valid value in a date range

    The data I am working with represent readings from different instruments. One field keeps track of a running summation so this number is steadily increasing. I need to look at the data for a given date, however the problem is that sometimes the instrument is turned off. In this case there would be no data for that date, however since all I am interested is the sum total for the signal on that instrument, I need to keep going back until I find the last valid data in the database which would represent the sum up to this point. How can I design a query or procedure that would handle this contingency? Here is some sample data:
    PV_ID                  SMPL_DTE                  INTEG_SINCE_VAL
    271                    20-JUL-08 12.05.00 AM     6172.0387459767
    271                    20-JUL-08 12.06.00 AM     6172.0387459767
    271                    21-JUL-08 12.05.00 AM     6172.0387459767
    271                    21-JUL-08 12.06.00 AM     6172.0387459767
    271                    21-JUL-08 08.43.00 AM     6172.0387459767
    271                    21-JUL-08 08.45.00 AM     6172.0387459767
    271                    22-JUL-08 12.05.00 AM     6172.0387459767
    271                    12-AUG-08 04.45.00 PM     6172.0387459767
    271                    12-AUG-08 04.50.00 PM     6172.038748687284 So if for instance I ran a query for July 30th, I'd need to actually get the result from July 22nd since it is the last valid number. PV_ID represents the instrument ID and INTEG_SINCE_VAL is the accumulated total for signal readings on that instrument.
    Edited by: Solerous on Mar 16, 2009 7:23 AM
    Edited by: Solerous on Mar 16, 2009 7:25 AM

    Hi,
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    Connected as hr
    SQL>
    SQL> SELECT *
      2  FROM   (WITH data AS (SELECT 271 AS PV_ID,
      3                               (SYSDATE - 5) AS SMPL_DTE,
      4                               23 AS INTEG_SINCE_VAL
      5                        FROM   dual
      6                        UNION ALL
      7                        SELECT 271 AS PV_ID,
      8                               (SYSDATE - 4) AS SMPL_DTE,
      9                               40 AS INTEG_SINCE_VAL
    10                        FROM   dual
    11                        UNION ALL
    12                        SELECT 271 AS PV_ID,
    13                               (SYSDATE - 1) AS SMPL_DTE,
    14                               50 AS INTEG_SINCE_VAL
    15                        FROM   dual)
    16             SELECT data.*,
    17                    rownum
    18             FROM   data
    19             WHERE  PV_ID = 271
    20             AND    SMPL_DTE <= SYSDATE -- your date goes here
    21             ORDER  BY smpl_dte DESC)
    22             WHERE  rownum = 1;
         PV_ID SMPL_DTE    INTEG_SINCE_VAL     ROWNUM
           271 3/15/2009 1              50          3
    SQL> Regards,

  • Limitation of SQL-Query data source !?

    Hello,
    I faced a situation that required the use of "case ... when ... then ...end" in my select-statement defining the data source. But I doesn't seem to work! I checked the statement in sql developer and it worked fine!
    Is there any idea about that?
    Thanks in advance.
    Dirk

    Hi Tim,
    thank you for your response - I created a sample query of what I used and it looks like this one:
    select col1
    ,col2
    , case col2 when '12' then (select a2.col2 from a2 where a2.col1 = a1.col1 )
    when '13' then (select a3.col2 from a3 where a3.col1 = a1.col1 )
         end
    from a1
    Dirk

  • Query date range modification

    Hi there, im new to BW and query designer. Im on BW 7.3. User has requested me to make modification to and existing BEX query. This query at present returns 1 month worth of data. the user now wants this query to return last year + current YTD data. How do I approach this modification, please suggest. thanks Regards

    Hi Samique,
    It is not clear why do you need the user to provide input for a report spanning from last year to YTD. I can only assume that it is either to decide the period till which YTD(year to date) values are to be calculated or to decide which of the last year periods will be considered.
    e.g. if user inputs 003.2015 then this will be the end period for YTD calculation or the last year data to be considered will be from 003.2014. Please provide clarification for this part.
    These both cases can be achieved using customer exit variable.
    Suppose you accept the user input in say variable Var1.
    Now, you need to create a new variable, VAR2, on 0FISCPER characteristics, with properties, select options range and processing as customer exit.
    In your query designer in the filter pane-> characteristics restriction, you must restrict 0FISCPER with Var2.
    Now in CMOD tcode you need to write a logic to fill the values for Var2.
    Logic could be as follows:
    Data: Curr_Period(7) TYPE C,
             Year (4)           TYPE C. 
    WHEN 'Var2'.
       IF i_step = 2.
         LOOP AT  i_t_var_range INTO  loc_var_range  WHERE  vnam = 'VAR1'.
          l_s_range-low = loc_var_range-low. (assuming the YTD end value is the user input)
    **OR ELSE if the YTD value is to be derived from system date then
         Curr_Period = get_period_from_date (sy-datum) . (pass system date to get current period )
         l_s_range-low = Curr_Period .
    Year =  loc_var_range-low(4) - 1 . (get last year value from Var1)
    CONCATENATE Year loc_var_range-low+4(3) INTO l_s_range-high.
    (Assuming the last year data is required from the period as entered by user).
    OR ELSE if entire last year data is required then
    CONCATENATE Year '001' INTO l_s_range-high.
           l_s_range-sign    = 'I'.
           l_s_range-opt      = 'EQ'.
        APPEND l_s_range  TO  e_t_range.
    EXIT.
    ENDLOOP.
    ENDIF.
    ENDCASE.
    Hope this helps.
    -Swati.

  • Plsql procedure with sql query data

    plsql newbie(learning sql): please excuse for asking a basic plsql question
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod on windows server 2003
    PL/SQL Release 10.2.0.1.0 - Production
    "CORE     10.2.0.1.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    CREATE OR REPLACE PROCEDURE p_check
    AS
    v1 NUMBER(20,0);
    BEGIN
    SELECT count(*) INTO v1
    FROM ad_reg;
    dbms_output.put_line(v1);
    end;
    inserts the number of rows in the table ad_reg into v1
    and displays v1 by using dbms_output
    i want my procedure to return table data
    CREATE TABLE "TEST_SH"
    "TEXT_ID" NUMBER,
    "TEXT" CLOB
    Insert into TEST_SH (TEXT_ID) values (1);
    Insert into TEST_SH (TEXT_ID) values (2);
    Insert into TEST_SH (TEXT_ID) values (3);
    Insert into TEST_SH (TEXT_ID) values (4);
    there will be a way with which i can see all the data(select * from test_sh) as the output of the plsql procedure
    1.please tel me what to google
    2.please guide me with a site or tell what is actually used and help me
    3.or post an example here
    thank you much
    Edited by: 946207 on Nov 20, 2012 2:05 PM

    946207 wrote:
    there will be a way with which i can see all the data(select * from test_sh) as the output of the plsql procedurePL/SQL is
    a) nothing at all like T-SQL
    b) two different languages, PL (Programming Logic) and SQL
    SQL is used to access data in the Oracle database. So select * from test_sh is the correct statement to access the data.
    The client can make execute this SQL statement itself. And view the data. However, this requires the client to understand the SQL language, and the database model. Which is typically not that you want. You want to abstract that from the client.
    Why would you want the client to deal with the complexities of the SQL language? Or deal with the complexities of your database model in Oracle?
    So instead of the client doing SQL, PL/SQL can do it on behalf of the client. The client uses PL/SQL as an API - in a similar fashion as the client would use any other API.
    The PL/SQL code determines the SQL statement - and returns a SQL cursor handle to the client. The client then simply uses the SQL cursor that the PL/SQL code created for it (and the client needs to close the SQL cursor when done, so as to not cause server resource leakage).
    E.g. (using PL/SQL as an API to abstract SQL and the data model)
    create or replace procedure TestProc( c out sys_refcursor ) is
    begin
      open c for select * from test_sh order by 1;
    end;The client then calls TestProc and gets a reference cursor handle. E.g. (the client call to Oracle):
    begin
      TestProc( c => :1 );
    end;The client needs to supply a host (client language) bind variable of type cursor, as value for bind variable +:1+.
    This is the correct way to deal with PL/SQL and cursors from a client GUI/language perspective. Any other method, like using PL/SQL to cache SQL data as a collection, is usually very wrong.

Maybe you are looking for