Selecting material based on date

Hello Experts,
I have requirement where i want to give material and date.
i have to select materia, condition record number based on date.
In database table field is stored like material , validity from date and validity to date.
Same material number is there but validity date and condtion record number is different.
Matno        from date                 to date                      Condition record no
1234       01.01.2009                31.12.2009                       23456
1234       01.01.2008                31.12.2008                       12367
if user enter date 12.09.2009 it should fetch me first record. ( because date is between 01.01.2009 to 31.12.2009)
if user enter date 20.08.2008 it should fetch me first record. ( because date is between 01.01.2008 to 31.12.2008)
field for input date is fkdate.
So how i have to query in select statement to get this requirement.
Thanks in advance.
Best regards,
Sai

select * "or the fields you need
       from abcd
        into table itab
        where matnr in s_matnr "if you have it in sel screen or remove it..
             and dat_fr GE p_fkdat
             and dat_to LE p_fkdat.
but if the dates are not keys...
better not use them in select...
delete the unnecessary items after the select using DELETE ITAB where...

Similar Messages

  • Select Query Based on date condition

    Hi ,
    Is it Possible.
    i want to run select query based on date condition.
    Eg...
    if the date between 01-jan-01 and 01-jan-05 then
    select * from table1;
    if the date between 02-jan-05 and 01-jan-08 then
    select * from table2;
    Becaz i have data in 2 diffrent tables , based on the date condition i wnt to run the select statement to diffrent tables.
    i dont want plsql here Just SQL needed.
    thanks,
    -R
    Edited by: infant_raj on May 5, 2009 11:48 PM

    Helo Kanish,
    this is not the one i was asking..
    wht i mean was .
    i use bind variable to get date while running the select statement , once i get the date then i want to choose any one of the table to run select query.
    EG..
    select col1,col2 from table1 where date between only if 01-jan-01 and 01-jan-05;
    select col1,col2 from table2 where date between only if 02-jan-05 and 01-jan-08;
    Run any one of the two . not all
    thanks,
    _raj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Select Product based on date

    Hai,
    Product Date
    pd0 2012-08-11 18:45:55.780
    Pd1 2012-08-11 18:55:17.020
    pd2 2012-08-11 19:06:58.623
    pd3 2012-08-18 12:00:01.193
    pd4 2012-08-25 12:13:04.077
    pd5 2012-08-25 17:28:30.347
    pd6 2012-08-25 18:23:16.473
    pd7 2012-09-18 18:29:58.360
    I want select the product based on from date and to date.
    For Example
    I want the select the product date in between 2012-08-11 to 2012-08-18
    Note:dont check the time.
    I want the query for select product based on only date not depend upon time

    >
    Product Date
    pd0 2012-08-11 18:45:55.780
    Pd1 2012-08-11 18:55:17.020
    pd2 2012-08-11 19:06:58.623
    pd3 2012-08-18 12:00:01.193
    pd4 2012-08-25 12:13:04.077
    pd5 2012-08-25 17:28:30.347
    pd6 2012-08-25 18:23:16.473
    pd7 2012-09-18 18:29:58.360
    I want select the product based on from date and to date.
    For Example
    I want the select the product date in between 2012-08-11 to 2012-08-18
    >
    Hopefully what you are calling 'Date', which is actually a timestamp value, is really being stored in a column of datatype TIMESTAMP and not being stored in a VARCHAR2.
    NEVER store date or datetime values in a character datatype. And the word BETWEEN, when used as an operator means that BOTH endpoints will be included.
    1. Data is stored in a TIMESTAMP column the way it should be stored
    WITH Q AS (SELECT 'pd0' PRODUCT, TO_TIMESTAMP('2012-08-11 18:45:55.780', 'YYYY-MM-DD HH24:MI:SS.FF3') myBadDateFormat from dual
    UNION ALL SELECT 'Pd1',TO_TIMESTAMP('2012-08-11 18:55:17.020', 'YYYY-MM-DD HH24:MI:SS.FF3') from dual
    UNION ALL SELECT 'pd2',TO_TIMESTAMP('2012-08-11 19:06:58.623', 'YYYY-MM-DD HH24:MI:SS.FF3') from dual
    UNION ALL SELECT 'pd3',TO_TIMESTAMP('2012-08-18 12:00:01.193', 'YYYY-MM-DD HH24:MI:SS.FF3') from dual
    UNION ALL SELECT 'pd4',TO_TIMESTAMP('2012-08-25 12:13:04.077', 'YYYY-MM-DD HH24:MI:SS.FF3') from dual
    UNION ALL SELECT 'pd5',TO_TIMESTAMP('2012-08-25 17:28:30.347', 'YYYY-MM-DD HH24:MI:SS.FF3') from dual
    UNION ALL SELECT 'pd6',TO_TIMESTAMP('2012-08-25 18:23:16.473', 'YYYY-MM-DD HH24:MI:SS.FF3') from dual
    UNION ALL SELECT 'pd7',TO_TIMESTAMP('2012-09-18 18:29:58.360', 'YYYY-MM-DD HH24:MI:SS.FF3') from dual)
    SELECT PRODUCT FROM Q
      WHERE myBadDateFormat BETWEEN TO_TIMESTAMP('2012-08-11', 'YYYY-MM-DD')
                                AND TO_TIMESTAMP('2012-08-18', 'YYYY-MM-DD')
    PRODUCT
    pd0
    Pd1
    pd2If you don't want the second endpoint included you need to use > and <= operators instead of BETWEEN.
    2. Data is stored in a VARCHAR2 column the way it should NEVER be stored
    WITH Q AS (SELECT 'pd0' PRODUCT, '2012-08-11 18:45:55.780' myBadDateFormat from dual
    UNION ALL SELECT 'Pd1','2012-08-11 18:55:17.020' from dual
    UNION ALL SELECT 'pd2','2012-08-11 19:06:58.623' from dual
    UNION ALL SELECT 'pd3','2012-08-18 12:00:01.193' from dual
    UNION ALL SELECT 'pd4','2012-08-25 12:13:04.077' from dual
    UNION ALL SELECT 'pd5','2012-08-25 17:28:30.347' from dual
    UNION ALL SELECT 'pd6','2012-08-25 18:23:16.473' from dual
    UNION ALL SELECT 'pd7','2012-09-18 18:29:58.360' from dual)
    SELECT PRODUCT FROM Q
      WHERE myBadDateFormat BETWEEN '2012-08-11' AND '2012-08-18'
    PRODUCT
    pd0
    Pd1
    pd2Neither of the solutions posted by others so far will work unless your data is stored in a TIMESTAMP column and even then Oracle will rewrite the filter to use TIMESTAMP values
    SQL> select product from test_timestamp
      2    WHERE myBadDateFormat < DATE '2012-08-18'
      3      AND myBadDateFormat >= DATE '2012-08-11'
      4  /
    Execution Plan
    Plan hash value: 3988574921
    | Id  | Operation         | Name           | Rows  | Bytes | Cost (%CPU)| Time   |
    |   0 | SELECT STATEMENT  |                |     3 |    54 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| TEST_TIMESTAMP |     3 |    54 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("MYBADDATEFORMAT"<TIMESTAMP'2012-08-18 00:00:00' AND
                  "MYBADDATEFORMAT">=TIMESTAMP'2012-08-11 00:00:00')
    Note
       - dynamic sampling used for this statement

  • Select Materials based on Characteristics

    Hello,
    I would like to select specific materials (<b>MARA</b>) based on the assigned characteristics and values (<b>AUSP</b>).
    My first approach would be the following: select table AUSP with the characteristic and value, then select MARA with <b>MARA-CUOBF</b> = <b>AUSP-OBJEK</b>.
    But, the problem is, that there is no index on the field <b>MARA-CUOBF</b>.
    Is there another way to select material based on characteristics and values? Does there any index table or reference table exist?
    Thank you for your assistance in advance.
    Best Regards,
    Kurt.

    Hi Kurt,
    there is a way if u know the characteristic of the material.
    give characteristic in AUSP-ATINN field in AUSP table.
    collect all OBJEK's for that characteristics.
    then go to table INOB, select objek from inob into itab where cuobj = ausp-objek.
    INOB-OBJEK gives u a combination of material number and batch number for that material number. ( there might be different batches for one material).
    so collect inob-objek and split into matnr and batch.
    there u get all materials according to ur characteristic
    and also collect those objeks where ur matnr is there.
    and regarding to that matnr and batch in MSEG table u can do rest of the stuff....
    reward if it helps
    Regards
    Message was edited by: srinu k

  • To select from database table based on date range

    hi
    i have a selection screen in which date range is being given
    say eg 23/06/07  to 23/12/08
    based on this date i want to select data from a ztable
    eg i want to select a field amount from table
    and three is a field date range on the table
    for this particular field i want to select all records for amount field  and factual field falling wiithing this date range and sum it
    eg
    based on date range as in selcetion screen
    select amount( field1)  factual ( field2) from ztable into it_ztable where date = ?....
    please give me code for it  and how to sum all values as i will get from the ztable into internal table the two values as fetched from the ztable
    please suggest asap
    regards
    arora

    hi
    i am using
    sELECT field1 field2 FROM Ztable  INto it_matu
                       where DATE GE sl_dat-low    
                        AND  DATE LE sl_dat-high.   
    i am getting data in internal table but
    say i have twelve records now i want to sum it the both the columns into and use that sum final amount to display
    let me know how to use sume in the intrranal tabl do i need to use control statement
    how to use the sum for two columns and take into a serperate variable to display
    regards
    aRora

  • Select records based on monthly anniversary date

    Hi,
    I have a table with a date_added field and I want to select records based on the monthly anniversary date of this field.
    eg. ID, Date_added
    1, 10-DEC-2012
    2, 11-NOV-2012
    3, 10-MAR-2012
    4, 28-FEB-2012
    5, 30-DEC-2012
    So For the 10th of Jan 2013, I would want to return records 1 and 3 only
    I started looking at the extract function, but this soon falls down for records at the end of the month. For example, on the 28th Feb, I would also want to include records where the date_added day is the 29th, 30th or 31st. So, in the table above I would want to return records 4 and 5, but extract would only return 4.
    Is there a simple function to do this month anniversary query - am I missing something very obvious? Or, do I need to write a query to explicitly cope with dates at the end of the month? So far I haven't found a sensible simple solution!
    I'm using 11g
    thanks

    I didn't look into leap year, but this should give you a starting point:
    select  *
      from  t
      where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
                  when to_date(:target_date,'mmddyyyy')
                    then case
                           when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
                             then 1
                         end
                  else case
                           when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
                             then 1
                         end
                end
    /For example, target date is 1/10/2013:
    SQL> variable target_date varchar2(8)
    SQL> exec :target_date := '01102013';
    PL/SQL procedure successfully completed.
    SQL> with t as (
      2             select 1 id,to_date('10-DEC-2012','dd-mon-yyyy') date_added from dual union all
      3             select 2,to_date('11-NOV-2012','dd-mon-yyyy') from dual union all
      4             select 3,to_date('10-MAR-2012','dd-mon-yyyy') from dual union all
      5             select 4,to_date('28-FEB-2012','dd-mon-yyyy') from dual union all
      6             select 5,to_date('30-DEC-2012','dd-mon-yyyy') from dual
      7            )
      8  select  *
      9    from  t
    10    where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
    11                when to_date(:target_date,'mmddyyyy')
    12                  then case
    13                         when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
    14                           then 1
    15                       end
    16                else case
    17                         when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
    18                           then 1
    19                       end
    20              end
    21  /
            ID DATE_ADDE
             1 10-DEC-12
             3 10-MAR-12
    SQL> And target date is 2/28/2013:
    SQL> exec :target_date := '02282013';
    PL/SQL procedure successfully completed.
    SQL> with t as (
      2             select 1 id,to_date('10-DEC-2012','dd-mon-yyyy') date_added from dual union all
      3             select 2,to_date('11-NOV-2012','dd-mon-yyyy') from dual union all
      4             select 3,to_date('10-MAR-2012','dd-mon-yyyy') from dual union all
      5             select 4,to_date('28-FEB-2012','dd-mon-yyyy') from dual union all
      6             select 5,to_date('30-DEC-2012','dd-mon-yyyy') from dual
      7            )
      8  select  *
      9    from  t
    10    where 1 = case last_day(to_date(:target_date,'mmddyyyy'))
    11                when to_date(:target_date,'mmddyyyy')
    12                  then case
    13                         when to_char(date_added,'dd') >= to_char(to_date(:target_date,'mmddyyyy'),'dd')
    14                           then 1
    15                       end
    16                else case
    17                         when to_char(date_added,'dd') = to_char(to_date(:target_date,'mmddyyyy'),'dd')
    18                           then 1
    19                       end
    20              end
    21  /
            ID DATE_ADDE
             4 28-FEB-12
             5 30-DEC-12
    SQL> SY.

  • Dynamic Select List based on TextField data

    Hi,
    I like to dynamically display the select list based on the value in the textfield, the data in the textfield is of character type.
    Thanks

    Hello,
    Well as you now know HTML based select lists don't work like that, that widget is called a combo box and there will be built in combo boxes in APEX 3.0, it's a fairly complex dhtml widget.
    What you might want to do is provide a text item next to your select box and an Add New Value Option in your select list.
    Carl

  • Performance issue while selecting material documents MKPF & MSEG

    Hello,
    I'm facing performance issues in production while selecting Material documents for Sales order and item based on the Sales order Stock.
    Here is the query :
    I'm first selecting data from ebew table which is the Sales order Stock table then this query.
        IF ibew[] IS NOT INITIAL AND ignore_material_documents IS INITIAL.
    *     Select the Material documents created for the the sales orders.
          SELECT mkpf~mblnr mkpf~budat
                 mseg~matnr mseg~mat_kdauf mseg~mat_kdpos mseg~shkzg
                 mseg~dmbtr mseg~menge
           INTO  CORRESPONDING FIELDS OF TABLE i_mseg
           FROM  mkpf INNER JOIN mseg
           ON    mkpf~mandt = mseg~mandt
           AND   mkpf~mblnr = mseg~mblnr
           AND   mkpf~mjahr = mseg~mjahr
           FOR   ALL entries IN ibew
           WHERE mseg~matnr      = ibew-matnr
           AND   mseg~werks         = ibew-bwkey
           AND   mseg~mat_kdauf   = ibew-vbeln
           AND   mseg~mat_kdpos  = ibew-posnr.
          SORT i_mseg BY mat_kdauf ASCENDING
                         mat_kdpos ASCENDING
                         budat     DESCENDING.
        ENDIF.
    I need to select the material documents because the end users want to see the stock as on certain date for the sales orders and only material document lines can give this information. Also EBEW table gives Stock only for current date.
    For Example :
    If the report was run for Stock date 30th Sept 2008, but  on the 5th Oct 2008, then I need to consider the goods movements after 30th Sept and add if stock was issued or subtract if stock was added.
    I know there is an Index MSEG~M in database system on mseg, however I don't know the Storage location LGORT and Movement types BWART that should be considered, so I tried to use all the Storage locations and Movement types available in the system, but this caused the query to run even slower than before.
    I could create an index for the fields mentioned in where clause , but it would be an overhead anyways.
    Your help will be appreciated. Thanks in advance
    regards,
    Advait

    Hi Thomas,
    Thanks for your reply. the performance of the query has significantly improved than before after switching the join from mseg join mkpf.
    Actually, I even tried without join and looped using field symbols ,this is working slightly faster than the switched join.
    Here are the result ,  tried with 371 records as our sandbox doesn't have too many entries unfortunately ,
    Results before switching the join  146036 microseconds
    Results after swithing the join        38029 microseconds
    Results w/o join                           28068 microseconds for selection and 5725 microseconds for looping
    Thanks again.
    regards,
    Advait

  • Read data based on date in internal tables

    Hi Abapers,
    In my zreport , i am retreving data from vbrk, vbrp into one internal table ( itab1) and retreiving data from customized table i nto internal table itab2.
    itab1 contains following fields.
    matnr - Material code
    erdat - date ( billing date).
    itab2 contains following fields.
    matnr - material code.
    zfromdate - from date
    ztodate  - to date
    zstprs - material price
    loop at itab1 .
    endloop.
    how to read particular record from itab2 ( which consists of material code with price maintaing with  date range )  based on my billing document date i.e erdat 
    ex: material code     fromdate             todate           price
         10000          01.11.2008     20.11.2008     100.
         10000          21.11.2008     30.11.2008     104
    if for example in itab1 , erdat ( billing doc date is 15.11.2008 ) , how to read first record in itab2 which will fall under that date range.
    please give me any suggestions, or provide sample code.
    regards,
    Hari priya

    Hi,
    Please go in this way
    while selecting fileds from table into itab2
    select in this way
    select * from  <tablename> into tabel itab2 where
      matnr = itab1-matnr and
      zfromdate LE erdat and
      ztodate   GE erdat.
    Loop at itab2.
    read table itab1 with key matnr = itab2-matnr.
    take ur fields into internal table
    endloop.

  • Help please: Selective Deletion of Infocube data (Sales)

    Dear Experts
    Am working on a BW 3.5 server
    I have been referring to the below SDN posting
    <u>Selective Deletion of Infocube data</u>
    My scenario is like this..
    My Sales data infocube has multiple records with the
    same Delivery number and Bill of Lading number
    (same material number also).
    Some of these records are having "Created" status
    others are with "Cancelled" status.
    Requirement is to retain latest record based on Billing date
    after deleting previous records
    having same Delivery number and Bill of Lading number.
    Kindly advice a best practice solution.
    warm Regards,
    AbyJ
    ============

    Hi,
    I think selective deletion won't be the right solution to your problem.
    I would suggest to build up a second cube as a 1:1 copy of your sales cube.
    Build a transformation or update rule from your old to your new cube. In the startroutine you can now easily retain latest record based on Billing date
    after deleting previous records having same Delivery number and Bill of Lading number by sorting your data package according to this fields. After you have checked it in the new cube, you can either leave that and build the reporting on this cube if possible or in a second step you have to delete data in your old cube and then reload your new cube completely in your old cube. Build a transformation or update rule, easy 1:1 relations and reload data.
    An issue for this approach can be the number of records in your sales cube.
    Regards,
    Juergen

  • Batch Determination based on date of consig recieve

    Hi,
    I am getting problem when i am trying to do manual batch determination in the outbound delivery.
    I have created a record in VCH1 based on customer/Material/Plant. In this i have maintained a sort rule also. what characteristaics i must use to make my batch determination based on customer consignment recieving date?
    If i go in MSC3n with Material, Plant and batch data then in the screen ( table MCHA, MCH1) onlt data available is for ERSDA, LAEDA  and LWEDT.
    In delivery when i click on batch determination button. my Sort rule is not automatically determined. So i have to maunally entered my soirt rule but at the same time my qty proposal in the same screen is 1 which is nothing but
    FORM CHMVS_001.
      DATA: lv_line TYPE kondh-chasp VALUE '1'.
      LOOP AT disqty.
        CHECK lv_line <= no_of_split.
        IF QUAN_TO_DIS > 0.
          IF DISQTY-AVAL_QUAN > QUAN_TO_DIS.
            DISQTY-QUANTITY = QUAN_TO_DIS.
          ELSEIF disqty-aval_quan > 0.
            DISQTY-QUANTITY = DISQTY-AVAL_QUAN.
          ENDIF.
          IF disqty-quantity > 0.
            quan_to_dis = quan_to_dis - disqty-quantity.
            MODIFY disqty TRANSPORTING quantity.
            ADD 1 TO lv_line.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM
    When i am taking characteristics LOBM_VFDAT for sort rule in Cu70 then i am not getting batch determination as i required even if i maintained Shelf expiry date in MSC3n.
    Please suggest where i must look into so that my batch determination would be based on date of consignment recieved.. currently if it s taking based on max qty available in MMBE.
    Regards
    Nitin

    I have already assigned sort rule in VCH1 but dont know which Characteristics i must assign for customer consignment stock on FIFO basis. Could you please tell me the characteristics for it which i must consider?
    LOMB_VFDAT i have already tried but its not working for me.
    Edited by: Nitin Agarwal on Oct 30, 2008 8:14 AM

  • How to use multiple selection parameters in the data model

    Hi, after have looked all the previous threads about how to use multiple selection parameters , I still have a problem;
    I'm using Oracle BI Publisher 10.1.3.3.2 and I'm tried to define more than one multiple selection parameters inside the data template;
    Inside a simple SQL queries they work perfectly....but inside the data template I have errors.
    My data template is the following (it's very simple...I am just testing how the parameters work):
    <dataTemplate name="Test" defaultPackage="bip_departments_2_parameters">
    <parameters>
    <parameter name="p_dep_2_param" include_in_output="false" datatype="character"/>
    <parameter name="p_loc_1_param" include_in_output="false" datatype="character"/>
    </parameters>
    <dataTrigger name="beforeReport" source="bip_departments_2_parameters.beforeReportTrigger"/>
    <dataQuery>
    <sqlStatement name="Q2">
    <![CDATA[
    select deptno, dname,loc
    from dept
    &p_where_clause
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_DEPT" source="Q2">
    <element name="deptno" value="deptno"/>
    <element name="dname" value="dname"/>
    <element name="loc" value="loc"/>
    </group>
    </dataStructure>
    </dataTemplate>
    The 2 parameters are based on these LOV:
    1) select distinct dname from dept (p_dep_2_param)
    2) select distinct loc from dept (p_loc_1_param)
    and both of them have checked the "Multiple selection" and "Can select all" boxes
    The package I created, in order to use the lexical refence is:
    CREATE OR REPLACE package SCOTT.bip_departments_2_parameters
    as
    p_dep_2_param varchar2(14);
    p_loc_1_param varchar2(20);
    p_where_clause varchar2(100);
    function beforereporttrigger
    return boolean;
    end bip_departments_2_parameters;
    CREATE OR REPLACE package body SCOTT.bip_departments_2_parameters
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    if (p_dep_2_param is not null) --and (p_loc_1_param is not null)
    then
    p_where_clause := 'where (dname in (' || replace (p_dep_1_param, '''') || ') and loc in (' || replace (p_loc_1_param, '''') || '))';
    else
    p_where_clause := 'where 1=1';
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments_2_parameters;
    As you see, I tried to have only one p_where_clause (with more than one parameter inside)....but it doesn't work...
    Using only the first parameter (based on deptno (which is number), the p_where_clause is: p_where_clause := 'where (deptno in (' || replace (p_dep_2_param, '''') || '))';
    it works perfectly....
    Now I don't know if the problem is the datatype, but I noticed that with a single parameter (deptno is number), the lexical refence (inside the data template) works.....with a varchar parameter it doesn't work....
    So my questions are these:
    1) how can I define the p_where_clause (inside the package) with a single varchar parameter (for example, the department location name)
    2) how can I define the p_where_clause using more than one parameter (for example, the department location name and the department name) not number.
    Thanks in advance for any suggestion
    Alex

    Alex,
    the missing thing in your example is the fact, that if only one value is selected, the parameter has exact this value like BOSTON. If you choose more than one value, the parameter includes the *'*, so that it looks like *'BOSTON','NEW YORK'*. So you need to check in the package, if there's a *,* in the parameter or not. If yes there's more than one value, if not it's only one value or it's null.
    So change your package to (you need to expand your variables)
    create or replace package bip_departments_2_parameters
    as
    p_dep_2_param varchar2(1000);
    p_loc_1_param varchar2(1000);
    p_where_clause varchar2(1000);
    function beforereporttrigger
    return boolean;
    end bip_departments_2_parameters;
    create or replace package body bip_departments_2_parameters
    as
    function beforereporttrigger
    return boolean
    is
    l_return boolean := true;
    begin
    p_where_clause := ' ';
    if p_dep_2_param is not null then
    if instr(p_dep_2_param,',')>0 then
    p_where_clause := 'WHERE DNAME in ('||p_dep_2_param||')';
    else
    p_where_clause := 'WHERE DNAME = '''||p_dep_2_param||'''';
    end if;
    if p_loc_1_param is not null then
    if instr(p_loc_1_param,',')>0 then
    p_where_clause := p_where_clause || ' AND LOC IN ('||p_loc_1_param||')';
    else
    p_where_clause := p_where_clause || ' AND LOC = '''||p_loc_1_param||'''';
    end if;
    end if;
    else
    if p_loc_1_param is not null then
    if instr(p_loc_1_param,',')>0 then
    p_where_clause := p_where_clause || 'WHERE LOC in ('||p_loc_1_param||')';
    else
    p_where_clause := p_where_clause || 'WHERE LOC = '''||p_loc_1_param||'''';
    end if;
    end if;
    end if;
    return (l_return);
    end beforereporttrigger;
    end bip_departments_2_parameters;
    I've written a similar example at http://www.oracle.com/global/de/community/bip/tipps/Dynamische_Queries/index.html ... but it's in german.
    Regards
    Rainer

  • How to create a Platinum,Gold and Silver Customer and how to set different price for a single material based on customer?

    Hi All,
    How to create a Platinum,Gold and Silver Customer and how to set different price for a single material based on customer?
    Assume Material is Pen.
    While creating Sales Order in VA01 how to bring different price for the same material for Platinum,Gold and Silver Customers.
    Kindly help me out.
    Thanks,
    Renjith Jose

    A good place to start is http://www.javaworld.com/javaworld/javatips/jw-javatip34.html
    Also, do a search in this forum on HttpURLConnection. That class allows you to use POST method to send form data to a web server.
    "Hidden" variables are only hidden in HTML. The HTTP that gets POSTed to the web server doesn't distinguish between hidden and not hidden. That is, the content you would write to the HttpURLConnection.getOutputStream() would be something like:
    hidden=1&submit=ok(Of course, the variable names would depend on what the web server was expecting from the form.)
    Also, be sure to set the Content-Type request parameter to "application/x-www-form-urlencoded"

  • How to add an index to a materialized view in Data Modeler 3.3

    Hello everyone,
    I'm looking for a how-to to add an index to a materialized view in Data Modeler 3.3.0.747, as I coudn't find a way to do it so far.
    I looked here:
    Relational Model
    Physical Model
    Oracle 11g
    Materialized Views
    "my_mv_name"
    "INDEXES" IS NOT HERE IN THE TREE
    "Tables" does not include it either
    Thank you & Best regards,
    Blama

    Hi David,
    thanks a lot. I did so and it worked, but I found a minor bug while doing so:
    I marked the table as "Implement as Materialized View" and went to File->Export->DDL (for Oracle 11g).
    The generated code (I checked all options in "Drop Selection") includes a row:
    DROP MATERIALIZED VIEW mv_mymatview CASCADE CONSTRAINTS ;
    which produces a syntax error.
    Best regards,
    Blama

  • How to display data from a recordset based on data from another recordset

    How to display data from a recordset based on data from
    another recordset.
    What I would like to do is as follows:
    I have a fantasy hockey league website. For each team I have
    a team page (clubhouse) which is generated using PHP/MySQL. The one
    area I would like to clean up is the displaying of the divisional
    standings on the right side. As of right now, I use a URL variable
    (division = id2) to grab the needed data, which works ok. What I
    want to do is clean up the url abit.
    So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end all
    I want is clubhouse.php?team=Wings.
    I have a separate table, that has the teams entire
    information (full team name, short team, abbreviation, conference,
    division, etc. so I was thinking if I could somehow do this:
    Recordset Team Info is filtered using URL variable team
    (short team). Based on what team equals, it would then insert this
    variable into the Divisional Standings recordset.
    So example: If I type in clubhouse.php?team=Wings, the Team
    Info recordset would bring up the Pacific division. Then 'Pacific'
    would be inserted into the Divisional Standings recordset to
    display the Pacific Division Standings.
    Basically I want this
    SELECT *
    FROM standings
    WHERE division = <teaminfo.division>
    ORDER BY pts DESC
    Could someone help me, thank you.

    Assuming two tables- teamtable and standings:
    teamtable - which has entire info about the team and has a
    field called
    "div" which has the division name say "pacific" and you want
    to use this
    name to get corresponding details from the other table.
    standings - which has a field called "division" which you
    want to use to
    give the standings
    SELECT * FROM standings AS st, teamtable AS t
    WHERE st.division = t.div
    ORDER BY pts DESC
    Instead of * you could be specific on what fields you want to
    select ..
    something like
    SELECT st.id AS id, st.position AS position, st.teamname AS
    team
    You cannot lose until you give up !!!
    "Leburn98" <[email protected]> wrote in
    message
    news:[email protected]...
    > How to display data from a recordset based on data from
    another recordset.
    >
    > What I would like to do is as follows:
    >
    > I have a fantasy hockey league website. For each team I
    have a team page
    > (clubhouse) which is generated using PHP/MySQL. The one
    area I would like
    > to
    > clean up is the displaying of the divisional standings
    on the right side.
    > As of
    > right now, I use a URL variable (division = id2) to grab
    the needed data,
    > which
    > works ok. What I want to do is clean up the url abit.
    >
    > So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end
    > all
    > I want is clubhouse.php?team=Wings.
    >
    > I have a separate table, that has the teams entire
    information (full team
    > name, short team, abbreviation, conference, division,
    etc. so I was
    > thinking if
    > I could somehow do this:
    >
    > Recordset Team Info is filtered using URL variable team
    (short team).
    > Based on
    > what team equals, it would then insert this variable
    into the Divisional
    > Standings recordset.
    >
    > So example: If I type in clubhouse.php?team=Wings, the
    Team Info recordset
    > would bring up the Pacific division. Then 'Pacific'
    would be inserted into
    > the
    > Divisional Standings recordset to display the Pacific
    Division Standings.
    >
    > Basically I want this
    >
    > SELECT *
    > FROM standings
    > WHERE division = <teaminfo.division>
    > ORDER BY pts DESC
    >
    > Could someone help me, thank you.
    >

Maybe you are looking for