SELECT data based on partitions

I know we have PARTITION clause in SELECT statement.
My requirement is i need to select data from Last two partitions in which data is available.
If we know the name of the 2 partitions then we can select and UNION ALL.
But In my case, i dont know the partitition names too,
I need to find out the names of the partitions using any subquery and i need to select from that.
May i know how can i achieve this?
Thanks

Maybe you could adjust the below (NOT TESTED !) if the meaning of the recent 2 partitions is somehow connected with partition_position within [url http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/statviews_2108.htm#REFRN20281]all_tab_partitions as I don't have a database at hand to find out how partitions are being numbered.
declare
  the_sql   varchar2(32000) := q'{ your sql here }'; -- assumed having a where clause
  the_table varchar2(30)    := 'your_table_name';
begin
  for i in (select partition_name
              from all_tab_partitions
             where table_name = the_table
               and partition_position <= 2  -- assumed ascending order for partition numbering
  for i in (select partition_name
              from (select partition_name,row_number() over (order by partition_position desc) rn
                      from all_tab_partitions
                     where table_name = the_table
             where rn <= 2  -- assumed descending order for partition numbering
  loop
    substr(the_sql,1,instr(the_sql,'where')) || ' partition (' || i.partition_name || ') ' ||
    substr(the_sql,instr(the_sql,'where')) || ' union all ';
  end loop;
  the_sql := 'select * from (' || substr(the_sql,1,instr(the_sql,' union all ',-1,1)) || ')';
  dbms_output(the_sql);
end;Regards
Etbin

Similar Messages

  • Selecting data from Multiple Partitions in a single select stmt.

    Hi all,
    My Database is very large & my tables are partitioned.
    My question is:
    1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
    If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
    (Note:I dont want to make use of Union concept, i want to do it in a single select statement)
    For ex:
    qry1.sql:
    select empno from emp_trans partition (P012000)
    This above query(qry1.sql) will work fine.
    qry2.sql:
    select empno from emp_trans partition (P012000,P022000)
    The above query(qry2.sql) will return will return the following error:
    ORA-00933: SQL command not properly ended
    If anybody has any solution for this, pls mail me immediately.
    Thanks in advance
    bye
    null

    All my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
    Thaks for ur reply
    Bye
    null

  • Select data based on status priority

    ID     PRO_ID     PRO_OBJ_ID     TASK_ID     DEVELOPER_ID     STATUS
    121243     4940     37506     5250     6532     REJECTED
    122063     4940     37506     5250     6532     CLOSE
    138306     4940     37506     5250     6532     ACCEPTED
    138307     4940     37506     5250     6532     WIP
    Hi,
    From the above table i need to select data based on status any status that is prior to CLOSE or ACCEPTED it must display all the status any status that is after CLOSE or ACCEPTED we must not consider.
    In the above scenioro it must display only the first three status. after ACCEPTED it must not display any thing
    Please suggest me a query how to write.
    Thanks
    Sudhir.

    Try:
    SQL> with t as (
      2  select 121243 id, 4940 pro_id, 37506 pro_obj_id, 5250 task_id, 6532 developer_id, 'REJECTED' status from dual union all
      3  select 122063, 4940, 37506, 5250, 6532, 'CLOSE' from dual union all
      4  select 138306, 4940, 37506, 5250, 6532, 'ACCEPTED' from dual union all
      5  select 138307, 4940, 37506, 5250, 6532, 'WIP' from dual union all
      6  select 138308, 4940, 37506, 5250, 6532, 'ACCEPTED' from dual union all
      7  select 138309, 4940, 37506, 5250, 6532, 'REJECTED' from dual union all
      8  select 121243, 4940, 37777, 5250, 6532, 'REJECTED' from dual union all
      9  select 122063, 4940, 37777, 5250, 6532, 'CLOSE' from dual union all
    10  select 138306, 4940, 37777, 5250, 6532, 'ACCEPTED' from dual union all
    11  select 138307, 4940, 37777, 5250, 6532, 'WIP' from dual union all
    12  select 138308, 4940, 37777, 5250, 6532, 'ACCEPTED' from dual union all
    13  select 138309, 4940, 37777, 5250, 6532, 'WIP' from dual
    14  ) -- actual query starts here:
    15  select t1.id
    16  ,      t1.pro_id
    17  ,      t1.pro_obj_id
    18  ,      t1.task_id
    19  ,      t1.developer_id
    20  ,      t1.status
    21  from   t t1
    22  where id <= (select max(id)
    23               from   t t2
    24               where  t2.status in ( 'ACCEPTED', 'CLOSED' )
    25               and    t1.pro_id = t2.pro_id
    26               and    t1.pro_obj_id = t2.pro_obj_id
    27               and    t1.task_id = t2.task_id
    28               and    t1.developer_id = developer_id
    29               );
            ID     PRO_ID PRO_OBJ_ID    TASK_ID DEVELOPER_ID STATUS
        121243       4940      37506       5250         6532 REJECTED
        122063       4940      37506       5250         6532 CLOSE
        138306       4940      37506       5250         6532 ACCEPTED
        138307       4940      37506       5250         6532 WIP
        138308       4940      37506       5250         6532 ACCEPTED
        121243       4940      37777       5250         6532 REJECTED
        122063       4940      37777       5250         6532 CLOSE
        138306       4940      37777       5250         6532 ACCEPTED
        138307       4940      37777       5250         6532 WIP
        138308       4940      37777       5250         6532 ACCEPTED
    10 rows selected.If that doesn't work then please provide us some representative sample data again.

  • Select Data based on User Permissions

    Post Author: nomore
    CA Forum: General
    I've got a Crystal Infoview server which is becoming quite cluttered with reports.In a lot of instances, I will have 4 or 5 copies of the same report which are tailored to specifc users. For example a sales report which will show data based on a specific customer. I could create on report with a parameter where the user could just select the customer - but i dont want some people to be able to see specific customers. So at present i have a seperate report for each customer - and then set the report permissions to only allow specific users to run it.I attended a course a while back where they showed us how, hiding particular fields/data to certain users if they should
    not be allowed to view it - but for the life in me i cannot remember at
    all how they did it.  Any tips greatly appreciated.

    Post Author: V361
    CA Forum: General
    In the special fields section is CurrentCEUserName, not sure if this would work for you, because I have CR XI
    You could surpress based on the id logged in, but that would be a lot of work, 
    Perhaps you could create a "permissions" list in excel or in the database if possible, with a list of the reports that each ID can run, then based on the id, you populate the list....
    CurrentCEUserName inserts (in a formula) the name that was used to log on to the current session when using the Log On to BusinessObjects Enterprise dialog box.

  • Facing problem in selecting data based on the join s tatement ppls suggest

    hi
    cosider a sceneio as below
    there  are six tables    table1
                                    table2 
                                    table3       table4 
                                                               table5 table6
    join conditons between tables
    table1-lclic (primary key) = table2-lclic
    table1-lgreg = table3-lgreg (PK for table 3)
    table2-pobj = table4-pobj
    i have used join statment to join table 1 table 2table3
    i want to select data from table5
    table5-ccngn and table6-text
    now condion for validation is that
    table5-field1 is selected if table4-ctsex = table3-ctsty and tehre is no link between table 5 and table 3 o nly link is through table 4
    table4-ctsnum=table5-ctsnum (primary keys)
    can anyone suggest how to format the select statement
    regards
    Arora

    Hi Nishant,
    Using Table Joins for multiple tables would severely hamper the performance of the SAP system.
    Instead use individual select statements for each database table, and later reconcile all the internal tables.
    <b>Reward points, if helpful.</b>
    Regards,
    Atin

  • Select data based insert

    Hi,
    Is there a way to select data to select data wht is been inserted in time. means there are so many insert process keep happing In my application i need to select which is happend very recently.
    How to select such data please suggest
    If table name is "Contribution" .
    Please suggest
    Thanks
    Sudhir

    Hi ,
    You can include a column as inserted_time and keep the data type as date and default value is sysdate, now every time a record is being inserted the inserted_time field will get populated with value sysdate,
    now to query the latest record you can use like below
    select <column-names> from <table-name>
    order by inserted_time descin this way you can view which all record are inserted recently. I hope it is clear :)
    If you have any doubt then tell.
    regards

  • How to select data, based on a specified or preset date/time range

    Hi,
    I am trying to construct a requirement like this in java/jsp.
    I have a table consisting of registered users info. Have a expiration date for every user, which was captured or set when they originally registered.
    I have to select all those users who are expiring two weeks from now.
    For example. if the current date is 14th, I should get a list of users who expire between the midnight of 24th sunday to 30th saturday. this covers the whole last 7days in that range. And so on.
    So based on the current date, the last midnight sunday to midnight saturday of that two week's range should be selected.
    The input fields for this range on the userend should default to this range.
    And also the user should be able to specify their own range and be able to pull data.
    the result should be populated as viewable as well as a downloadable tab de-limited file for mass mailing.
    (ex. the table might be queried for user info like id, email, expiration date, fullname, and shown accordingly in the jsp)
    I know this is a longshot.. but if somebody can guide me will be good as I am new to this forum and as well as java.

    Well, I can start you off with this:
    Calendar now = Calendar.getInstance();
    // shift 2 weeks and back to Sunday
    Calendar start = Calendar.getInstance();
    start.add(Calendar.DATE, 14);
    end.set(Calendar.HOUR, 0);
    end.set(Calendar.MINUTE, 0);
    end.set(Calendar.SECOND, 0);
    end.set(Calendar.MILLISECOND, 0);
    while(start.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
    start.add(Calendar.DATE, -1);
    // shift 2 weeks and up to Saturday (following Sundat midnight, actually)
    Calendar end = Calendar.getInstance();
    end.add(Calendar.DATE, 14);
    end.set(Calendar.HOUR, 0);
    end.set(Calendar.MINUTE, 0);
    end.set(Calendar.SECOND, 0);
    end.set(Calendar.MILLISECOND, 0);
    while(end.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
    end.add(Calendar.DATE, -1);
    At this point, start is the first Sunday before the day 2 weeks from today and end is the first Sunday after the day 2 weeks from today, both at midnight. You could make end stop at Saturday and make the time 23:59:59:999, of course.
    If you ran it today, it should be 11/9 and 11/16.

  • Need multiple variables to select data based on OR condition not AND condit

    Hello All,
    We have a requirement where we want the user to enter a variable 1X.  Then based on this entry select from the InfoCube to check multiple fields where this value could potentially be.  If we put variables on each characteristic in the query and let them input the same value for each, the system tries to find a record where all characteristics have this value.  Our situation is that we don't know if field1, field2, field3 will have this value.  So an OR condition, not an AND needs to be generated.
    We are stuck.  Has anyone tried this before?
    Thanks!

    You can create 3 restricted Key Figures.
    RKF1 : KF restricted by var1 on Char A
    RKF2 : KF restricted by var2 on Char B
    RKF3 : KF restricted by var3 on Char C
    Make var1, var2 and var3 as ready for input. Don't use variables in Free Characteristic

  • How to select data based on date range

    Hi all,
    how do I make the following scenario happen:
    I am tracking my sales people's performance from 1/01/00 to 1/01/09, and I want to give $200 bonuses to only those whom made a sale between 1/01/06 to 1/01/08.  I need a formula that captures the sale between 1/01/06 to 1/01/08 and assign a $200 bonus that I can then insert into my report as a field. 
    I've been trying with the "If" "then" functions, and I'm unsure how to incorporate the date field into it. 
    please help!
    Thanks,
    Frank

    Hi Newbie,
    You will have to create the following formula, call it @Bonus and place it in the detail section:
    If {date.field} >= Date(2006,01,01) and
    {date.field} <= Date(2008,01,01) then
    200 else 0
    You can then summarize it however you want.
    I hope this helps,
    Regards,
    Zack H.

  • Creating report based on user selected Date Range

    Hello.
    I am trying to display an Apex report that selects data for the report based on a user entered date range.
    It's a simple page with two date picker fields (p18_start and p18_end).
    The report region SQL looks like this:
    SELECT *
    FROM prj_items
    WHERE LM_DT BETWEEN :p18_start AND :P18_end
    One table, one field on the table to search and two Apex variables.
    I thought this would be fairly simple, but I am obviously missing something.
    I not even sure what other information is needed to help me figure this out.
    -Jody

    Hi,
    You can set defaults for the datepickers if you need to - this could be done in a computation on the page for each item and conditional on the item being null.
    When I've done something similar to this, I've created two hidden page items - eg, :P19_FIRST_DATE and :P19_LAST_DATE and populated these with the earliest/latest date that the user could reasonably select (perhaps, in your case, the MIN(LM_DT) and MAX(LM_DT) values).
    Then your SQL would be:
    select * from PRJ_ITEMS
    where LM_DT BETWEEN TO_DATE(NVL(:P19_START,:P19_FIRST_DATE), 'DD-MON-YY')
    AND TO_DATE(NVL(:P19_END,:P19_LAST_DATE), 'DD-MON-YY')If you don't want to set default dates, you could do something like:
    SELECT * FROM PRJ_ITEMS
    WHERE (:P19_START IS NULL AND :P19_END IS NULL)
    OR (:P19_START IS NOT NULL AND :P19_END IS NULL AND LM_DT >= TO_DATE(:P19_START,'DD-MON-YY'))
    OR (:P19_START IS NULL AND :P19_END IS NOT NULL AND LM_DT <= TO_DATE(:P19_END,'DD-MON-YY'))
    OR (LM_DT BETWEEN TO_DATE(:P19_START,'DD-MON-YY') AND TO_DATE(:P19_END,'DD-MON-YY'))There are various reasons why your two dates are being cleared when the page is reloaded. Firstly, you should check the branch that returns to the same page - make sure you are not clearing the cache for the page. Then, have a look to see if there is a "reset page" process (usually created for you when you create a form page). Then, check the Source settings for the items. Typically, these would be "Only when current value in session state is null" and a Source Type of "Static Assignment" with the "Source Value or Expression" left empty.
    Andy

  • Select data from Table1 based on Table2

    Hi Guys,
    Can you guide me up on how to select data from Table1 based on Table2?
    I want to fetch data which is not there in table2 in my table1 select query.
    Is that I have to do it with the loops after I select data from both tables or can it be handled directly in my select query?
    Please suggest.
    Regards,
    Kumar.

    hi
    Try This
    In Where condition filedname (Not Equal) < > itab2-fieldname.
    select * from itab1
    into table lt_tab.
    seect * from itab2
    into table lt_tab
    for all entries in lt_tab
    where name < >(Not Equal to)itab2-fieldname.

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

  • 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 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • JDBC to IDOC Scenario - select data in jdbc based on multiple conditions

    Hello
         I have a JDBC to IDOC Scenario. I have to select the records in JDBC based on different conditions each time. For example I have to select based on company code '1000' and Employee claasification 'E1' and date range. After I post these records in SAP again I want to select other records for some other company code '2000' and different business area and different dates. Basically I want to extract data multiple times based on different conditions.
    Hiow do I achieve this?
    Another question is in the JDBC to IDOC scenario since the sender adapter is JDBC and the sender adapter polls depending on the duration of time ( say 60 secs ) in the adapter once after I extract the data based on a condition how do I control in such a way that the same data is not extracted again.
    Thanks
    Naga

    Hi Naga,
    I have to select the records in JDBC based on different conditions each time. For example I have to select based on company code '1000' and Employee claasification 'E1' and date range. After I post these records in SAP again I want to select other records for some other company code '2000' and different business area and different dates. Basically I want to extract data multiple times based on different conditions.
    -->
    Such requirements cant be handle through select query of the sender...but you can handle this in the message mapping area.....you can fire a select query in the database to pick up records in a batch of 10K (do not keep any condition on this except for sorting). After the records come into PI you can send the message to your target based on the unique combination of "Company code+ Employee clasification + date range" handling this in the message mapping.
    Another question is in the JDBC to IDOC scenario since the sender adapter is JDBC and the sender adapter polls depending on the duration of time ( say 60 secs ) in the adapter once after I extract the data based on a condition how do I control in such a way that the same data is not extracted again.
    You can use the N--> C logic
    The data records that you pick have a corresponding control table i assume. There should be a field STATUS where the initial status of record should be N.
    After you pick the records this status should be made C so that only those records present in the database with status = N are picked up.
    Mention the condition Status = N in the select query.
    Thanks
    Dhwani

Maybe you are looking for

  • After upgrading to 27, firefox will not start. Try every idea online for 4 hr. Nothing worked. Downgraded to 26

    I have the same problem as https://support.mozilla.org/he/questions/985552#question-reply I have tried everything i could find online. uninstall and re-install. tried even full uninstall, giving up my profile data (i back it up in chrome). Nothing wo

  • Minimise Server Click in a Table view in  BSP

    Hello All I have a issue related to TableView in a BSP Application Our requirement is : User want to edit a coolumn value for  few records displayed in a Table View . as per My knowledge , when a row is selected in a table view , system go to server

  • InDesign erroneously applies character style to imported text

    For a year, I had been importing text into InDesign with little trouble until this problem starting happening and I can't figure out why. Let's say I have a CS3 file with defined character and paragraph styles. If I draw an empty text box, InDesign s

  • Adding Clip art and text

    I am fine tuning my Premeire Elements Video and adding music, text and some clip art. I am using Premiere 8. When I add clip art and text it goes in fine but when I do a preview playback the text and or the clip art fanishes before the end of the cli

  • LR3 After 6 Months

    This is an observation rather than a query, since queries I have had have been answered by the good folk here. As the title says, I've been using Lightroom for 6 months now, LR 3 being the first version I've known. I do a lot of stuff for a stock age