How to get data from a table in a condition between twomonth

hai friends
I have a query that is i want to get data from a table based on a condition between two months in a format of char column
Ex
I have a column called from_month in the format of 'mon/yyyy'(already converted from date')
then the second column is to_month in the same format 'mon/yyyy'
now i wiil select from_month and to_month like
from month jan/2009
to month mar/2010
how to use between of two months in the format of char.Please tell me how to get two different month between data.

Hi,
This may be of help.
Remember Pointless has made a point ;) (worth millions)
If possible , DO NOT store dates as strings or numbers.Let dates be dates.
WITH dat AS
(SELECT ' THIS IS JAN' x,to_char(to_date('01-JAN-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS FEB' x,to_char(to_date('01-FEB-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS MAR' x,to_char(to_date('01-MAR-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS APR' x,to_char(to_date('01-APR-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS MAY' x,to_char(to_date('01-MAY-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS JUN' x,to_char(to_date('01-JUN-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS JUL' x,to_char(to_date('01-JUL-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS AUG' x,to_char(to_date('01-AUG-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS SEP' x,to_char(to_date('01-SEP-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS OCT' x,to_char(to_date('01-OCT-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual UNION
SELECT ' THIS IS NOV' x,to_char(to_date('01-NOV-2009','DD-MON-YYYY'),'mon/yyyy') y FROM dual)
SELECT * FROM dat
WHERE to_date(y,'mon/yyyy') BETWEEN to_date('01 jan 2009','dd mon yyyy') AND to_date('01 mar 2009','dd mon yyyy')Cheers!!!
Bhushan

Similar Messages

  • How to get data from three tables (A,B,C) having one to many relation between A and B .and having one to many reation between b and c

    i have  three tables A,B,C.  there is one to many relation between A and B. and one to many relation existed between table b and c . how will get data from these three tables

    check if this helps:
    select * --you can always frame your column set
    from tableA a
    left join tableB b on a.aid=b.aid
    left join tableC c on c.bid=b.bid
    This is just a general query. However, we can help you a lot more, if you can post the DDL + sample data and required output.
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • How to get data from COSP table, field HRKFT as the key to data from PM?

    Dear ladies and gentlemen!
    I need to get data from COSP table, field HRKFT as the key to data from PM tables (AFKO and AUFK).
    The problem is that it is a key field to the COSP, and all non-key fields as an alternative to HRKFT are not suitable for this task.
    All this is necessary for the extractor, which loads the data from the R \ 3 systems in the BW-system. I need to perform SELECT from a table COSP and maybe also JOIN, most likely between tables COSP and AUFK.
    What should I do in this case?
    Thank you very much in advance!

    From information on help.sap.com I've made a conclusion that one of possible solutions in theory is to modify standard extractor PM_OM_OPA_1 in order to make HRKFT field available for work, because by default it is hidden by SAP and not available for use as a key field.
    Of course, it's not a very good solution, but for now I know no other way to solve this problem.
    Maybe someone knows better ways? In this case I will be very grateful for any help!
    Moderator: You'd better post it on BI forums

  • How to get data from large table (more than 9 million rows) by EJB?

    I have a giant table, it has more than 9 million rows.
    I want to use ejb finders method to get data from this table but always get not enough memory error or time out error,
    Can anyone give me solutions?
    Thx

    Your problem may be that you are simply trying to load so many objects (found by your finder) that you are exceeding available memory. For example if each object is 100 bytes and you try to load 1,000,000 objects thats 100Mb of memory gone.
    You could try increasing the amount of memory available to OC4J with the appropriate argument on the command line (or in the 10gAS console). For example to make 1Gb available to OC4J you would add the argument:
    -Xmx1000m
    Of course you need have this available as hard memory on your server or you will incur serious swapping.
    Chris

  • How to get data from multiple tables

    Hello Everyone,
    I need to read data from a few tables (VBAK, VBAP, VBUK, VBUP etc.) because I'd like to get all open Sales Orders. I've tried to use RFC_READ_TABLE but it looks like it can read only 1 table at a time. I've tried to read data from individual table and then join them but it didn't work out very well because I got about 1.5 millions records from just the VBUP table. So anyone knows if there is any function that I can use to join those tables and just get the records I need?
    Any help would be highly appreciated.

    Hi Nhan,
    Thank you for your reply.
    Do I have to be a SAP developer to create BAPI on SAP? What kind of access rights do I need?
    I've tired to use other BAPIs such as BAPI_SalesOrder_GetList and it doesn't work for me because I don't have all customer numbers and I need to get all un-shipped orders for all customers.
    I've read a post on the internet brieftly menitoned that we can create a table to store information about the tables we want to join and then call the RFC_READ_TABLE function. Do you know if that is possible?
    Is there any other way you can think of?

  • OC4J - How to get data from large table (more than 9 million rows) by EJB?

    SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS
    O I use Jdeveloper to create EJB that has finder methods to get data from a big table (more S than 9 million rows). Deploy is OK but when run client program I always get timeout
    O error or not enough memory error,
    S Can any one help me?
    O urgent
    SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS SOS

    Your problem may be that you are simply trying to load so many objects (found by your finder) that you are exceeding available memory. For example if each object is 100 bytes and you try to load 1,000,000 objects thats 100Mb of memory gone.
    You could try increasing the amount of memory available to OC4J with the appropriate argument on the command line (or in the 10gAS console). For example to make 1Gb available to OC4J you would add the argument:
    -Xmx1000m
    Of course you need have this available as hard memory on your server or you will incur serious swapping.
    Chris

  • How to get data from the Tables (Can func.module help then how to write )

    Hi,
    Can anyone tell the use of functional module to extract the data from R/3.i am working on PM module and need to extract the status of work order and equipment which i can get from First i had to get objnr then i had to go to jsto in jsto i get stsma and estat. by using estat and stsma i can get status in table tj30t here estat is same as stat in jest table.
    how to get all these in bw . any help.
    I need status of work orders and equipments which exists in tj30t or we can get from tj30 tables in the fields txt30 and txt04
    Any one pls help to get all these stuff from R/3 to BW
    Regards
    Srini-----

    Hi
    You need to enhance (write a user exit) for your Data Source.
    Here are some links on UE:
    Enhancment Framework
    ====================
    SAP Help Enhancment Framework
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
    Enhancements in sap bw
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/59069d90-0201-0010-fd81-d5e11994d8b5
    User Exit Enhancments
    Enhancement
    User exit
    BADI
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
    Reg's
    Edan

  • How to Get Data From E070 table  From Asp

    HI,
       I am New to ALE, IDOC and BAPI Programming,
       I am just trying to fetch data from SAP through custom interface viz ASP.
       How to Do this.. Can anyone help me
    Regards
    Guhapriyan

    Hi,
    You will need some sort of a connector to fetch data from SAP using SAP. DCOM connector has been provided by SAP to fulfill this task. Please take a look at the documentation for DCOM connector. You can download latest version and documentation from service.sap.com/connectors.
    Regards

  • How to get data to internal table from function module tr_inspect_objects

    How to get data from funtion module to an internal table .
    function module name is tr_inspect_objects(code inspectore  se10)
    how top collect all   task request data into one internal table using this fm or we have to create another fm .
    If you have already made FM please give us the code .

    Hi,
    You can use tables E070 or E071 to get data into your internal tables instead of a function module.
    Hope this helps.
    BR
    Dep

  • Jdbc getting data from multiple tables

    hi guys
    how can i get data from multiple tables in MSAccess
    please help

    >
    here is code thata i want to do
    i have 3 tables in my MSAccess databace
    Stud_O which consist name,surname fields
    Stud_I consist address,tel
    Stud_E department,faculty fields
    Based on this I would guess that you are missing a key field. There is no way to connect the tables.
    I make the class to insert data to the tables. But
    cant do getting datas from this tables.
    can anybody help me in making query
    and method that displays reultset strings to the
    textBoxes
    A select ...
    select name,surname from Stud_O. Use the executeQuery() method.

  • Getting data from 7 tables

    I am converting a servlet based application to struts framework.I have a screen which gets data from 7 tables.I cannot use a stored procedure so has to manage using SQL queries.I thought i will query each table and set it to my struts form.The screen has lot of drop down boxes .
    I have heard of composite design pattern .Please let me know the best way to query the tables.Here are the queries.
    Select a.proj_id , a.proj_nm
    From stn_proj_et a, stn_proj b
    Where a.proj_id = b.proj_id
    And a.sftwr_id = 24
    And b.stn_id = 56602;
    Select round(utm_x,3) utm_x, round(utm_y,3) utm_y, stn_id
    From stn_loc_hist
    Where stn_id ='56602'
    And cur_use_cd = 1
    select data_tp_cd
    from data_coll_summ
    where stn_id ='56002'
    And rownum < 2;
    select lat_no,long_no,pnt_loc_dsc,srce_id,mthd_dtrmn_cd,ctrl_dtm_cd
    from stn_et
    where stn_id = '56002';
    select
    distinct sjr_utils.getcatalogvalue(mthd_dtrmn_cd)
    from stn_et;
    select
    distinct sjr_utils.getcatalogvalue(ctrl_dtm_cd)
    from stn_et;
    select distinct PROJ_NM from stn_proj_et where sftwr_id=24;
    Select a.stn_alias_nm stn_alias_nm, b.alias_orgn_nm alias_orgn_nm
    From stn_alias_nm a, alias_orgn_et b
    Where a.alias_orgn_id = b.alias_orgn_id
    And b.alias_orgn_tp = 0
    And stn_id = '56002';

    adithiananya wrote:
    I am converting a servlet based application to struts framework.How well do you know Struts?
    I have a screen which gets data from 7 tables.I cannot use a stored procedure so has to manage using SQL queries.I thought i will query each table and set it to my struts form.The screen has lot of drop down boxes .You don't need a stored procedure to query a database.
    I have heard of composite design pattern .This ain't it.
    Please let me know the best way to query the tables.Here are the queries.
    Select a.proj_id , a.proj_nm
    From stn_proj_et a, stn_proj b
    Where a.proj_id = b.proj_id
    And a.sftwr_id = 24
    And b.stn_id = 56602;What are those hard-wired magic numbers in the WHERE clause?
    >
    Select round(utm_x,3) utm_x, round(utm_y,3) utm_y, stn_id
    From stn_loc_hist
    Where stn_id ='56602'
    And cur_use_cd = 1What are those hard-wired magic numbers in the WHERE clause?
    >
    select data_tp_cd
    from data_coll_summ
    where stn_id ='56002'
    And rownum < 2;What are those hard-wired magic numbers in the WHERE clause?
    >
    select lat_no,long_no,pnt_loc_dsc,srce_id,mthd_dtrmn_cd,ctrl_dtm_cd
    from stn_et
    where stn_id = '56002';
    select
    distinct sjr_utils.getcatalogvalue(mthd_dtrmn_cd)
    from stn_et;
    select
    distinct sjr_utils.getcatalogvalue(ctrl_dtm_cd)
    from stn_et;
    select distinct PROJ_NM from stn_proj_et where sftwr_id=24;What are those hard-wired magic numbers in the WHERE clause?
    Select a.stn_alias_nm stn_alias_nm, b.alias_orgn_nm alias_orgn_nm
    From stn_alias_nm a, alias_orgn_et b
    Where a.alias_orgn_id = b.alias_orgn_id
    And b.alias_orgn_tp = 0
    And stn_id = '56002';What are those hard-wired magic numbers in the WHERE clause?
    Do you really want to execute different requests given input from the users? (e.g., enter a value in a text box and see the drop down list boxes change)
    %

  • How to copy data from transparent table to our own ceated z table?

    How to copy data from transparent table to our own ceated z table?
    Plz tell me different methods and which one is best?
    Is get data from sflight into table z* is correct?

    Hi Ajay,
    let us consider you have to copy EKKO table to ZEKKO table
    1. In ABAP program define internal table based on EKKO
    <b>     eg: i_ekko</b>
    2. Select the data from EKKO to i_ekko
    <b>     eg: select * from ekko into table i_ekko.</b>
    3. insert into Z-TABLE from the internal table
    <b>     eg: INSERT EKKO FROM TABLE I_EKKO.
               COMMIT WORK.</b>
    <u>To insert in internal table you can use the following:</u>
    1. INSERT [wa INTO|INITIAL LINE INTO] itab [INDEX idx].
    2. INSERT [wa INTO|INITIAL LINE INTO] TABLE itab.
    3. INSERT LINES OF itab1 [FROM idx1] [TO idx2] INTO itab2 [INDEX idx3].
    4. INSERT LINES OF itab1 [FROM idx1] [TO idx2] INTO TABLE itab2.
    <u>To inert in database table, use the following:</u>
    1. INSERT INTO <dbtabname> [CLIENT SPECIFIED] VALUES wa.
    2. INSERT <dbtabname> [CLIENT SPECIFIED] FROM TABLE itab.
    3. INSERT <dbtab> [CLIENT SPECIFIED]. oder
    4. INSERT <dbtabname> [CLIENT SPECIFIED] ... .
    <b>Reward points.. if helpful.
    Cheers !
    Moqeeth.</b>

  • How to send data from internal table to the shared folder in ABAP

    Hi experts,
             My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is  "
    xxx\y\z....".
    I do not have any idea on how to send data from internal table to the shared folder path.
    can anybody please help me out how to do this?
    Thanks & Regards
    Sireesha.

    Where that folder is located, its on presentation server i.e. desktop or application server.
    If its on presentation server, use FM GUI_UPLOAD.
    If its on application server, then use DATASET functions. Have a look at below link.
    [File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
    I hope it helps.
    Thanks,
    Vibha
    Please mark all the useful answers

  • How to retrieve data from plsql table in BI publisher Data template

    Hi All,
    I have created a data template for XML publisher report. In data template i m getting data from plsql table. for that i have created one package with pipelined function. I am able to run that sql from sql developer .But if i run the concurrent program then i got error like "java.sql.SQLSyntaxErrorException: ORA-00904: "XXXXX": invalid identifier".
    I have used the same parameters in Data template and concurrent program....
    please clarify me what needs to be done....
    thanks in advance....
    Regards,
    Doss

    Hi Alex ,
    i am using pipelined function and get the data from cursor and load it into plsql table (nested table). and i use the below in my data template to fetch the data:
    <sqlStatement name="Q1">
    <![CDATA[select * from  table(PO_SPEND_RPT_PKG.generate_report(P_ORG_ID,P_SOB_ID,P_ORG_NAME,P_PERIOD_NAME,P_CLOSE_STATUS,P_E_PCARD_NEED,P_REPORT_TYPE))]]>
    </sqlStatement>
    if i run the above in sql developer i can get the result....from apps if i run i got the error "java.sql.SQLSyntaxErrorException: ORA-00904: "P_ORG_ID": invalid identifier"
    Edited by: kalidoss on Sep 14, 2012 4:32 AM

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

Maybe you are looking for