Select Query on time stamp.

Hello Gurus,
Please help me in writing a select query with the where condition on time stamp for the field IBSP-VALFR and IBSP-VALTO, with the current system time stamp. I need pick all the values which falls in these two fields with the current time stamp.
Thanks & Regards,
Naresh.

Hi,
some how my code is not working...Please look at my code.
convert date sy-datum
             time sy-uzeit
   into time stamp low_validity
  time zone sy-zonlo.
SELECT  SP_INSTANCE INSTANCE EQUNO MATNO SERNO
         FROM IBSP INTO TABLE IT_IBSP
         for all entries in it_IBIN
         where ( SP_INSTANCE = IT_IBIN-INSTANCE OR
               INSTANCE = IT_IBIN-INSTANCE ) and
               VALFR Le low_validity and
               VALTO ge low_validity.
Its getting the values for which VALTO is less than current date.
Thanks & Regards,
Naresh.

Similar Messages

  • Select-options for time stamp

    Any ideas on which data element to be used for select-options for timestamp on the screen so that a user is able to f4 help too.
    i am using data element 'tzntstmps' but i am not getting f4 help for it.

    Hello Trivenn
    I do not think it makes sense to search for any other timestamp data element which might be part of a search help.
    TZNTSTMPS = UTC Time Stamp in Short Form (YYYYMMDDhhmmss)
    How could such a search help look like? A calendar control combined with some kind of "time control"?
    You may facilitate the entry of time stamps in such a way that if the user enters only a date in the LOW field (e.g. 20080422 without time) you change it AT SELECTION-SCREEN (PBO of your selection screen to 20080422000000).
    Correspondingly, you change a date value (e.g. 20080422) at the HIGH field into 20080422235959).
    If, however, the user enters already a complete timestamp you do not change anything.
    Regards
      Uwe

  • Select query giving Time out dump

    Hi All,
        I have written a select query on a table in BW system.The code for the same is attached below.The table contains some 6,00,000 records.This query is giving a time out error.Kindly look into the query and advice ways to make it work.Thanks.
        IF NOT lt_temp[] IS INITIAL.
          SELECT /bic/zprrmatnr objvers /bic/zprclwynr /bic/zprrmdlr
                 FROM  /bic/pzprrmatnr
                 INTO CORRESPONDING FIELDS OF TABLE lt_zprrmatnr
                 FOR ALL ENTRIES IN lt_temp
                 WHERE /bic/zprclwynr = lt_temp-temp
                 AND   objvers = 'A'.
        ENDIF.
    Thanks and Regards,
    Faisal

    Not only is it BW, it is also a customer table. Have a look here on how to research yourself:
    Please Read before Posting in the Performance and Tuning Forum
    Thomas

  • Select query taking time

    THe following query is taking time. Is there anyway better to write this query.
    SELECT PROGRAM_NAME_ID ,PROGRAM_NAME,sum(balance)"Unpaid Balance"
        FROM (
    SELECT DISTINCT
    PROGRAM_NAME_ID ,PROGRAM_NAME,
    t.billing_key billing_key,
    (TUFF_GENERIC_PKG.GET_TOTAL(t.billing_key,t.program_key)+
    nvl(PENALTY_INTEREST(t.billing_key,t.program_key,b.company_id,b.report_period ),0))
    -PAYMENT_AMOUNT(B.COMPANY_ID,T.PROGRAM_KEY,B.REPORT_PERIOD) Balance,
    Report_period,company_id
    FROM  BILLING B,
    PROG_SURCH T ,
    mv_program_dict P
    WHERE
    B.BILLING_KEY=T.BILLING_KEY
    AND  p.program_key= t.program_key(+)
    and company_id=:p3_hide_comp
    and b.SUBMIT_STATUS='S'
    union
    SELECT DISTINCT
    PROGRAM_NAME_ID ,PROGRAM_NAME,
    t.billing_key billing_key,
    (TUFF_GENERIC_PKG.GET_TOTAL(t.billing_key,t.program_key)+
    nvl(PENALTY_INTEREST(t.billing_key,t.program_key,b.company_id,b.report_period ),0))
    -PAYMENT_AMOUNT(B.COMPANY_ID,T.PROGRAM_KEY,B.REPORT_PERIOD) Balance,
    Report_period,company_id
    FROM  MV_BILLING B,
    MV_PROG_SURCH T ,
    mv_program_dict P
    WHERE
    B.BILLING_KEY=T.BILLING_KEY
    AND  p.program_key= t.program_key(+)
    and company_id=:p3_hide_comp
    order by report_period,program_name_id )
    where balance>=0
    GROUP BY PROGRAM_NAME_ID,PROGRAM_NAME
    ORDER BY PROGRAM_NAME_ID

    Hi,
    This is totally right.
    >
    Being one such call. The price for calling pl/sql functions in SQL can be quite high. I'd highly recommend you find a way to incorporate the pl/sql code into the SQL query.
    >
    but, try with this query. I hope would help you and return the rows you want.
    SELECT   program_name_id, program_name,
               SUM (  tuff_generic_pkg.get_total (billing_key, program_key)
                    + NVL (penalty_interest (billing_key,
                                             program_key,
                                             company_id,
                                             report_period
                           0
             - payment_amount (company_id, program_key, report_period) balance
        FROM (SELECT program_name_id, program_name, t.billing_key, t.program_key,
                     b.company_id, b.report_period
                FROM billing b, prog_surch t, mv_program_dict p
               WHERE b.billing_key = t.billing_key
                 AND p.program_key = t.program_key(+)
                 AND company_id = :p3_hide_comp
                 AND b.submit_status = 'S'
              UNION
              SELECT program_name_id, program_name, t.billing_key, t.program_key,
                     b.company_id, b.report_period report_period, company_id
                FROM mv_billing b, mv_prog_surch t, mv_program_dict p
               WHERE b.billing_key = t.billing_key
                 AND p.program_key = t.program_key(+)
                 AND company_id = :p3_hide_comp) sub
       WHERE   (  tuff_generic_pkg.get_total (billing_key, program_key)
                + NVL (penalty_interest (billing_key,
                                         program_key,
                                         company_id,
                                         report_period
                       0
             - payment_amount (company_id, program_key, report_period) >= 0
    GROUP BY program_name_id, program_nameObviosly I cannot testing.
    HTH -- johnxjean --

  • Query on time stamp

    Hi,
    suppose that i have region and sales columns and prompt column as month.
    if i select a prompt the corresponding sales will now along with tha i want sales from starting of the year.
    let us consider prompt value is 5-11-2010 then i want sales values from january to till that prompt value.
    if any one having idea help me

    Hi,
    I guess you have date column on which you want to apply filter.If yes then on that date column apply following two filters
    Monthnumber(Date_column) between 1 and monthnumber(@{PV_Date}
    and date<{@pv_var}
    where date_column is date column in your report on which you have to apply the filter
    PV_Date is presentation variable from prompt.
    hope this helps.Take care of syntax for presentation variable.
    Regards,
    Sandeep

  • Help to read a table with data source and convert time stamp

    Hi Gurus,
      I have a req and need to write a ABAP prog. As soon as i excute ABAP program it should ask me enter a data source name, then my ABAP prog has excute teh code, in ABAP code i have to read a table with this data source as key, sort time stamp from table and should display the data source and time stamp as output.
    As follows:
    Enter Data Source Name: 
    Then user enters : 2lis_11_vahdr
    Then out put should be "Data source  :"  10-15-2008.
    The time stamp format in table is 20,050,126,031,520 (YYYYMMDDhhmmss). I have to display as 05-26-2005. Any help would be apprciated.
    Thanks,
    Ram

    Hi Jayanthi Babu Peruri,
    I tried to extract YEAR, MONTH, DAY separately and using
    EDIT MASK written it.
    Definitely there will be some STANDARD CONVERSION ROUTINE will be there. But no idea about it.
    DATA : V_TS      TYPE TIMESTAMP,
           V_TS_T    TYPE CHAR16,
           V_YYYY    TYPE CHAR04,
           V_MM      TYPE CHAR02,
           V_DD      TYPE CHAR02.
    START-OF-SELECTION.
      GET TIME STAMP FIELD V_TS.
      V_TS_T = V_TS.
      CONDENSE V_TS_T.
      V_YYYY = V_TS_T.
      V_MM   = V_TS_T+4(2).
      V_DD   = V_TS_T+6(2).
      V_TS_T(2) = V_MM.
      V_TS_T+2(2) = V_DD.
      V_TS_T+4(4) = V_YYYY.
      SKIP 10.
      WRITE : /10 V_TS," USING EDIT MASK '____-__-________'.
              /10 V_YYYY,
              /10 V_MM,
              /10 V_DD,
              /10 V_TS_T USING EDIT MASK '__-__-__________'.
    If you want DATE alone, just declare the length of V_TS_T as 10.
    Regards,
    R.Nagarajan.
    We can -

  • SELECT query performance : One big table Vs many small tables

    Hello,
    We are using BDB 11g with SQLITE support. I have a query about 'select' query performance when we have one huge table vs. multiple small tables.
    Basically in our application, we need to run select query multiple times and today we have one huge table. Do you guys think breaking them into
    multiple small tables will help ?
    For test purposes we tried creating multiple tables but performance of 'select' query was more or less same. Would that be because all tables will map to only one database in backed with key/value pair and when we run lookup (select query) on small table or big table it wont make difference ?
    Thanks.

    Hello,
    There is some information on this topic in the FAQ at:
    http://www.oracle.com/technology/products/berkeley-db/faq/db_faq.html#9-63
    If this does not address your question, please just let me know.
    Thanks,
    Sandra

  • Table defination in datatype size can effect on query execution time.

    Hello Oracle Guru,
    I have one question , suppose I have create one table with more than 100 column
    and i tacke every column datatype varchar2(4000).
    Actual data are in every column not more than 300 character so in this case
    if i execute only select query
    so oracle cursor internaly read up to 4000 character one by one
    or it read character one by one and in last character ex. 300 it will stop there.
    If i reduce varchar2 size 300 instend of 4000 in table defination,
    so is it effect on select query execution time ?
    Thanks in advance.

    When you declare VARCHAR2 column you specify maximum size that can be stored in that column. Database stores actual number of bytes (plus 2 bytes for length). So if yiou insert 300 character string, only 302 bytes will be used (assuming database character set is single byte character set).
    SY.

  • Add Minutes to Date Time Stamp in Select Query

    Hi,
    I have date in one column and Minutes (240,480,.....etc) in another column.
    Below is the date format which i select in select query, now how should i add date column below with Minutes Column.
    to_char(Last_update_date,'DD/MM/YYYY HH:MI:SS AM')
    Thanks
    Pravin

    892547 wrote:
    Hi,
    I have date in one column and Minutes (240,480,.....etc) in another column.
    Below is the date format which i select in select query, now how should i add date column below with Minutes Column.
    to_char(Last_update_date,'DD/MM/YYYY HH:MI:SS AM')
    Thanks
    Pravinyou can NOT add to character datatype.
    what datatype is MINUTES column?

  • Oracle SQL Select query takes long time than expected.

    Hi,
    I am facing a problem in SQL select query statement. There is a long time taken in select query from the Database.
    The query is as follows.
    select /*+rule */ f1.id,f1.fdn,p1.attr_name,p1.attr_value from fdnmappingtable f1,parametertable p1 where p1.id = f1.id and ((f1.object_type ='ne_sub_type.780' )) and ( (f1.id in(select id from fdnmappingtable where fdn like '0=#1#/14=#S0058-3#/17=#S0058-3#/18=#1#/780=#5#%')))order by f1.id asc
    This query is taking more than 4 seconds to get the results in a system where the DB is running for more than 1 month.
    The same query is taking very few milliseconds (50-100ms) in a system where the DB is freshly installed and the data in the tables are same in both the systems.
    Kindly advice what is going wrong??
    Regards,
    Purushotham

    SQL> @/alcatel/omc1/data/query.sql
    2 ;
    9 rows selected.
    Execution Plan
    Plan hash value: 3745571015
    | Id | Operation | Name |
    | 0 | SELECT STATEMENT | |
    | 1 | SORT ORDER BY | |
    | 2 | NESTED LOOPS | |
    | 3 | NESTED LOOPS | |
    | 4 | TABLE ACCESS FULL | PARAMETERTABLE |
    |* 5 | TABLE ACCESS BY INDEX ROWID| FDNMAPPINGTABLE |
    |* 6 | INDEX UNIQUE SCAN | PRIMARY_KY_FDNMAPPINGTABLE |
    |* 7 | TABLE ACCESS BY INDEX ROWID | FDNMAPPINGTABLE |
    |* 8 | INDEX UNIQUE SCAN | PRIMARY_KY_FDNMAPPINGTABLE |
    Predicate Information (identified by operation id):
    5 - filter("F1"."OBJECT_TYPE"='ne_sub_type.780')
    6 - access("P1"."ID"="F1"."ID")
    7 - filter("FDN" LIKE '0=#1#/14=#S0058-3#/17=#S0058-3#/18=#1#/780=#5#
    8 - access("F1"."ID"="ID")
    Note
    - rule based optimizer used (consider using cbo)
    Statistics
    0 recursive calls
    0 db block gets
    0 consistent gets
    0 physical reads
    0 redo size
    0 bytes sent via SQL*Net to client
    0 bytes received via SQL*Net from client
    0 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    9 rows processed
    SQL>

  • Select query taking too much time to fetch data from pool table a005

    Dear all,
    I am using 2 pool table a005 and a006 in my program. I am using select query to fetch data from these table. i.e. example is mentioned below.
    select * from a005 into table t_a005 for all entries in it_itab
                       where vkorg in s_vkorg
                       and     matnr in  s_matnr
                       and     aplp   in  s_aplp
                       and     kmunh = it_itab-kmunh.
    here i can't create index also as tables are pool table...If there is any solutions , than please help me for same..
    Thanks ,

    it would be helpful to know what other fields are in the internal table you are using for the FOR ALL ENTRIES.
    In general, you should code the order of your fields in the select in the same order as they appear in the database.  If you do not have the top key field, then the entire database is read. If it's large then it's going to take a lot of time.  The more key fields from the beginning of the structure that you can supply at faster the retrieval.
    Regards,
    Brent

  • Time Taking while firing a select Query

    i am unable to access the table "X" in ABC schema
    its taking toooooooooo much time while firing just a select query
    how to resolve it
    "SELECT digital_signing_cert
    FROM X"

    could be due to huge table size,crosscheck this from user_segments view.
    select bytes/1024/1024 "MB" from user_segments where segment_name='X';
    also check database alert log for any error.

  • TIME-OUT error in BSAK select query(Progress Indicator is also used)

    Hi,
        In my report program one select query is there on BSAK table, which is as follows --
           SELECT BUKRS                                                     
                         BELNR
                        GJAHR
                        SHKZG
                        BSCHL
                        UMSKZ
                        LIFNR
                        EBELN
                        EBELP
                        WRBTR
                        DMBTR
                        XZAHL
                        REBZG
                       AUGBL
                       BLART
                       AUFNR
                       AUGDT
                       BUZEI FROM BSAK
                                  INTO TABLE IT_BSAK
                                  FOR ALL ENTRIES IN IT_BKPF1
                                   WHERE BUKRS = IT_BKPF1-BUKRS
                                                AND AUGDT = IT_BKPF1-BUDAT
                                                AND AUGBL = IT_BKPF1-BELNR
                                                AND BSCHL IN ('31' , '29', '26', '39', '25').
    I used Progress Indicator befor running this query and after this query also. But still It's giving me TIME-OUT error in this select query only.
      I run the same query for 10 records in IT_BKPF1 table, it runs perfectly. But when I run it for 1000 records it giving dump.
    And in actual bussiness my records are always more than 100 only.
    I also check the indexing. It having secondary indexing on this BUKRS, AUGDT, AUGBL fields. Then also it's giving error.
    so, How can I solve this dump..?? What could be the reason..??
    Thanks in advance...!!
    Regards,
    Poonam.

    Hi Poonam Patil,
    Try to provide BELNR and GJAHR in where condition...
    BKPF-DBBLG ==> BSAK-BELNR
    Also check
    BKPF-BLDAT ==> BSAK-AUGDT
    Check out above relation...
    If data is there in these fields of the table and both are matching then you can pass it and as they are in primary key of BSAK it will improve the performance...
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • Select Query in Want unique time.

    Please go through below detail
    I have one table.
    File Id, Date, Time
    00001 10/12/2010 10:10
    00001 10/12/2010 10:10
    00001 10/12/2010 10:10
    00001 10/12/2010 10:11
    00002 10/12/2010 10:10
    00002 10/12/2010 10:10
    I want unique fileid,date and time in select query only.
    If apply group by File Id, Date, Time then I want increment time +1.
    New column
    00001 10/12/2010 10:10 10:10
    00001 10/12/2010 10:10 10:12 <-- We can not set 10:11 due to it's already exist in table.
    00001 10/12/2010 10:10 10:13
    00001 10/12/2010 10:11 10:11
    In short i would like select fileid,date,time,(Id duplicate entry then time +1 to generate uniquness).
    I have do this for myself but i face this problem.
    Query to fatch below all duplicate row
    time+1
    00001 10/12/2010 10:10 10:10
    00001 10/12/2010 10:10 10:11 <-- But this enty again become duplicate due to it's already exist in table.
    00001 10/12/2010 10:10 10:12
    Thanks in advance.

    I want time as it is means 23:11 it should not convert to 11:11:00 PMThat has nothing to do with the query.
    Just adjust your NLS_DATE_FORMAT:
    SQL> alter session set nls_date_format='dd/mm/yyyy hh:mi:ss PM';
    Session altered.
    SQL> with t as(
      2  select '00001' id,to_date('20101012 23:10','yyyymmdd hh24:mi') val from dual union all
      3  select '00001', to_date('20101012 23:10','yyyymmdd hh24:mi') from dual union all
      4  select '00001', to_date('20101012 23:59','yyyymmdd hh24:mi') from dual union all
      5  select '00001', to_date('20101012 23:59','yyyymmdd hh24:mi') from dual union all
      6  select '00002', to_date('20101012 10:10','yyyymmdd hh24:mi') from dual union all
      7  select '00002', to_date('20101012 10:10','yyyymmdd hh24:mi') from dual)
      8  select ID,Val
      9  from t
    10  model
    11  partition by(ID)
    12  dimension by(row_number() over(partition by id order by Val) as rn)
    13  measures(Val)
    14  rules(Val[rn > 1] order by rn
    15  = greatest(Val[cv()-1]+interVal '1' minute,
    16  Val[cv()]));
    ID    VAL
    00001 12/10/2010 11:10:00 PM
    00001 12/10/2010 11:11:00 PM
    00001 12/10/2010 11:59:00 PM
    00001 13/10/2010 12:00:00 AM
    00002 12/10/2010 10:10:00 AM
    00002 12/10/2010 10:11:00 AM
    6 rows selected.
    SQL> alter session set nls_date_format='dd/mm/yyyy hh24:mi';
    Session altered.
    SQL> with t as(
      2  select '00001' id,to_date('20101012 23:10','yyyymmdd hh24:mi') val from dual union all
      3  select '00001', to_date('20101012 23:10','yyyymmdd hh24:mi') from dual union all
      4  select '00001', to_date('20101012 23:59','yyyymmdd hh24:mi') from dual union all
      5  select '00001', to_date('20101012 23:59','yyyymmdd hh24:mi') from dual union all
      6  select '00002', to_date('20101012 10:10','yyyymmdd hh24:mi') from dual union all
      7  select '00002', to_date('20101012 10:10','yyyymmdd hh24:mi') from dual)
      8  select ID,Val
      9  from t
    10  model
    11  partition by(ID)
    12  dimension by(row_number() over(partition by id order by Val) as rn)
    13  measures(Val)
    14  rules(Val[rn > 1] order by rn
    15  = greatest(Val[cv()-1]+interVal '1' minute,
    16  Val[cv()]));
    ID    VAL
    00001 12/10/2010 23:10
    00001 12/10/2010 23:11
    00001 12/10/2010 23:59
    00001 13/10/2010 00:00
    00002 12/10/2010 10:10
    00002 12/10/2010 10:11
    6 rows selected.

  • Select query taking more time..

    Hi friends..
    The below inner join statement is taking more time ,  can any  body sugget me to improve the performance . I tried FOR ALL ENTRIES also but that also taking more time than inner join statement .
    SELECT a~vbeln from vbap as a inner join vakpa as b
          on avbeln = bvbeln
          into corresponding fields of table IT_VAKPA
          where a~WERKS IN S_IWERKS
          and a~pstyv NE 'ZRS'
          and b~vkorg = IVKORG
          and b~audat IN IAUDAT
          and b~vtweg IN IVTWEG.
    Regards
    Chetan

    Hi Chetan ,
    VAKPA is an index table. From the select query , it has been observed that you are not fetching any data from VAKPA. Only you have added some selection paramenters in where clause of select query.
    My suggestion will be instead of using VAKPA in inner join you use VBAK along with VBAP. All the fields that you are using as selection condition from VAKPA are there in VBAK.
    I am sure performance of query will be improved.
    If still duo to business logic you need to use VAKPA, try to create secondary non unique index on fields VKORD,AUDATand VTWEG on table VAKPA.
    However I will recommend you to go for first option only. If this does not work then go for second option.
    Hopfully this will help you.
    Regards,
    Nikhil

Maybe you are looking for

  • CRM V5.0 in Interaction Center Webclient

    Hi all, In CRM V5.0 in Interaction Center creation of Service ticket want to make changes in the Work Space.(T.code SE80) o     Reason Field      Can “Reason” be changed to “Origin” with the following values in the drop down: •     Ticket •     Phon

  • Will playlists be duplicated when two libraries are merged by iTunes Match?

    Hi All! I am preparing to start up iTunes Match, and will be attempting to merge two libraries, one from my wife's machine and one from my own. Most of the contents of these libraies is, in fact, duplicative, but there are likely several hundreds tra

  • Loosing sound whit Premium HD usb

    loosing sound whit Premium HD usbmI have just bought this new Sound Blaster Premium Hd usb sound card. When I start my computer up,there is no sound. I have to pull out the usb cabel,and then reconnect it again. When I am listen to music for some tim

  • Silverlight page requires refresh to load (Internet Explorer 11)

    We have a strange problem with a site that uses Silverlight. When you open the page from e.g. your IE11 favorites, the page is not loaded. No error message, even though the page's tab text and icon are shown. Only when you refresh the page with F5, t

  • Where is the technical help?

    where is the tech help ? dont get it when we phone