Alternative for "check select-options" for select query.

hi all,
my report is using a "GET" syntax, followed by "check select-options".
My senior told me to replace the Get syntax with select query.
Now, my program also has dynamic selection screen.
the dynamic selection screen almost has all the fields of database table.
so, what is the way to replace this check select-options while applying select query?
can you tell me how dynamic selection screen fields are populated? are they stored in some internal table?
thanks for help.

HI
Here is some points about LDB.
Logical databases are special ABAP programs that retrieve data and make it available to application programs. The most common use of logical databases is still to read data from database tables by linking them to executable ABAP programs.
However, from Release 4.5A, it has also been possible to call logical databases using the function module LDB_PROCESS. This allows you to call several logical databases from any ABAP program, nested in any way. It is also possible to call a logical database more than once in a program, if it has been programmed to allow this. This is particularly useful for programs with type 1.
Logical databases contain Open SQL statements that read data from the database. You do not therefore need to use SQL in your own programs. The logical database reads the program, stores them in the program if necessary, and then passes them line by line to the application program or the function module LDB_PROCESS using an interface work area
For further on LDB's refer to this link.
[http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm]
Hope this will help.
Reward if helpful.
Sumit Agarwal

Similar Messages

  • Error in Extended syntax check- Select Query

    Hi all,
    Iam getting this following error in Extended syntax check
    " Large table PA0002: No field of a table index in WHERE
    condition"
    Code :SELECT SINGLE PERNR INTO (G_PERNR) FROM PA0002 WHERE ZZLEGACY_PAYROLL = I_FILETAB-PRNO
                                                           AND ZZLEGACY_PAYSYS = I_FILETAB-PRSYS
                                                           AND ZZLEGACY_PAYINS = I_FILETAB-PRINS.
    can anyone help on this?

    Hi,
    Change the code like this and check............
    For this u need put INSIDE LOOP.
    Select single PERNR into G_PERNR from PA0002 where PERNR = I_FILETAB-PRNO and .......... and ......
    Check like this...
    Thanks.
    If this helps you reward with points.
    Message was edited by: KDeepak
    Message was edited by: KDeepak

  • Check select query

    Hi friends,
    I need to check if the below update statement ran successfully in the database..
    update tranp
    set serialno = (select transt.serialno from transt, tranht where tranp.billno= tranht.billno and tranht.refno = transt.refno);
    Is it possible to check? Please help...
    Thank you

    Hi Pavan,
    I'm getting this error..
    select a.*,b.transt,b.serialno
    from tranp a, (select transt.serialno from transt, tranht where tranp.billno= tranht.billno and tranht.refno = transt.refno) b
    where a.serialno(+) = b.serialno;
    tranp.billno invalid identifier
    When I add tranp to the sub select I get this error..
    select a.*,b.transt,b.serialno
    from tranp a, (select transt.serialno from TRANP,transt, tranht where tranp.billno= tranht.billno and tranht.refno = transt.refno) b
    where a.serialno(+) = b.serialno;
    B.transt invalid identifier
    Please help.. thanks

  • How to set default value in select option for ABAP query

    Hi experts,
    What is the way to set up default values for select-options in ABAP query.
    e.g.
    I have one field 'Year' in my ABAP query selection screen.
    I want value of current year to be appeared here whenever user execute report
    Thanks in Advance
    -Harkamal

    Hi Harkamal,
    execute your Query via SQ01. On Selection-Screen
    goto save Variant. Mark your field
    as selection variable an press Button election variable.
    Take variable from TVARV and use it.
    Than save the Variant.
    Look at TVARV if the 'Year' is updated to the actualYear!
    regards, Dieter

  • Logic required for select query

    i have a internal table with 4 columns. 3 columns having varrious material numbers. i want to check every material with mara table. its available or not?
    I need to write a single select queary? how to do this?
    My internal table looks like
    matnr     idnrk          s_idnrk          normt
    test10     10UPC3050     F14839030     test.
    i wrotes like below
       select matnr from mara into table
                     i_mara2 for all entries in
                     i_sub_file
                     where matnr =  i_sub_file-matnr and
                           matnr =  i_sub_file-idnrk and
                           matnr = i_sub_file-s_idnrk.
    Its not working, How to manage this? Anyone help this.
    Mohaha

    Hi fill the ranges with ur 3 material numbers.
    and use it in ur select query.
    define a range for mat no.
    ranges : r_matnr for mara-matnr.
    read table or loop with i_sub_file.
      r_matnr-sign = 'I'.
      r_matnr-option = 'EQ'.
      r_matnr-low = 'i_sub_file-matnr.
      append r_matnr. clear r_matnr.
      r_matnr-sign = 'I'.
      r_matnr-option = 'EQ'.
      r_matnr-low = 'i_sub_file-idnrk.
      append r_matnr. clear r_matnr.
      r_matnr-sign = 'I'.
      r_matnr-option = 'EQ'.
      r_matnr-low = 'i_sub_file-s_idnrk.
      append r_matnr. clear r_matnr.
    now in select.
    select matnr from mara into table
    i_mara2  where matnr in r_matnr.

  • What does it mean when the usecounts of Parse Tree for a view is incrementing when a select query is issued against the view?

    I'm using SQL Server 2008 R2 (10.50.4033) and I'm troubleshooting an issue that a select query against a specific view is taking more than 30 seconds consistently.   The issue just starts happening this week and there is no mass changes in data.  
    The problem only occur if the query is issued from an IIS application but not from SSMS.  One thing I noticed is that sys.dm_exec_cached_plans is returning 2 Parse Tree rows for the view -  one created when the select query is issued
    1st time from the IIS application and another one created when the same select query is issued 1st time from SSMS.   The usecounts of the Parse Tree row for the view (the IIS one) is increasing whenever the select query is issued.  The
    usecounts of the Parse Tree row for the view (the SSMS one) does not increase when the select query is issued again. 
    There seems to be a correlation between the slowness of the query and the increasing of the usecounts of the Parse Tree row for the view.  
    I don't know why there is 2 Parse Tree rows for the view.  There is also 2 Compiled Plan rows for the select query.  
    What does the Parse Tree row mean especially the usecounts column?

    >> The issue just starts happening this week and there is no mass changes in data.  
    There might be a mass changes in the execution plan for several reason without mass changes in data
    If you have the old version and a way to check the old execution plan, and compare to the new one, that this should be your starting point. In most cases you don't have this option and we need to monitor from scratch.
    >> The problem only occur if the query is issued from an IIS application but not from SSMS.
    This mean that we know exactly what is the different and you can compare both execution plan. once you do it, you will find that they are no the same. But this is very common issue and we can know that it is a result of different SETting while connecting
    from different application. SSMS is an external app like any app that you develop in Visual studio but the SSMS dose not use the Dot.Net default options.
    Please check this link, to find the full explanation and solutions:
    http://www.sommarskog.se/query-plan-mysteries.html
    Take a look at sys.dm_exec_sessions for your ASP.Net application and for your SSMS session.
    If you need more specific help, then we need more information and less stories :-)
    We need to see the DDL+DML+Query and both execution plans
    >> What does the Parse Tree row mean
    I am not sure what you mean but the parse tree represents the logical steps necessary to execute the query that has been requested. you can check this tutorial about the execution plan: https://www.simple-talk.com/sql/performance/execution-plan-basics/ or
    this one: http://www.developer.com/db/understanding-a-sql-server-query-execution-plan.html
    >> regarding the usecount column or any other column check this link:
    https://msdn.microsoft.com/en-us/library/ms187404.aspx?f=255&MSPPError=-2147217396.
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Select query for KONV and VBAK table

    hy Experts.
    Please Help me For this Query, i got error on it.
    I wnt to take KONV-KBETR (RATE FIELD) for particular  SO number. and i used following query but it gives error i cant relate VBAK & KONV table.
    Please do needful
    SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV) WHERE VBAK-KNUMV = KONV-KNUMV AND VBAK-VBELN IN VBELN.
    Thnks
    Bhavesh Panchal.

    Hello Thnks For Reply,
    but still i cant take solution. i am making a Sales order Rports. i got all field but i cant fetch filed for RATE and Pending Order Value.
    Please check following  Code. if need to change u can.
    Thnks
    Bhavesh Panchal.
    REPORT  ZTESTCODE.
    TYPE-POOLS:slis.
    TABLES: VBEP , VBAP ,  VBPA , VBKD , VBAK , LIKP , LIPS , VBUP , VBBE, KONV, KNA1.
    DATA :BEGIN OF itab  OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    EDATU LIKE VBEP-EDATU,
    KNUMV LIKE VBAK-KNUMV,
    WMENG LIKE VBEP-WMENG,
    BMENG LIKE VBEP-BMENG,
    LFIMG LIKE LIPS-LFIMG,
    OMENG LIKE VBBE-OMENG,
    POSAR LIKE VBAP-POSAR,
    NETWR LIKE VBAP-NETWR,
    NTGEW LIKE VBAP-NTGEW,
    KBETR LIKE KOMV-KBETR,
    KUNNR LIKE  VBAK-KUNNR,
    NAME1 LIKE  KNA1-NAME1,
    *BRGEW LIKE  VBAP-BRGEW,
    BSTKD LIKE VBKD-BSTKD,
    BSTDK LIKE VBKD-BSTDK,
    LFSTA LIKE VBUP-LFSTA,
    *KNUMV LIKE VBAK-KNUMV,
    *posnr LIKE LIPS-POSNR,
    *NETWR LIKE VBAK-NETWR,
    BRGEW LIKE VBAP-BRGEW,
    LFDAT LIKE LIKP-LFDAT,
    *NTGEW LIKE LIKP-NTGEW,
    DELIVERY LIKE LIPS-VBELN,
    WEIGHT like VBAP-NTGEW,
    END OF itab.
    *variable for Report ID
    DATA: v_repid LIKE sy-repid .
    *declaration for fieldcatalog
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
          wa_fieldcat TYPE slis_fieldcat_alv.
    DATA: it_listheader TYPE slis_t_listheader.
    declartion for layout
    DATA: alv_layout TYPE slis_layout_alv.
    *Title displayed when the alv list is displayed
    *DATA:  i_title_main TYPE lvc_title VALUE 'FIRST LIST DISPLAYED'.
    DATA:  i_title_main TYPE lvc_title VALUE 'Reports : Bhavesh Pacnhal'.
    INITIALIZATION.
      v_repid = sy-repid.
      PERFORM build_fieldcatlog.
      SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
         SELECT-OPTIONS : VBELN FOR VBAK-VBELN ,
                          KUNNR FOR VBPA-KUNNR ,
                          EDATU for ITAB-EDATU.
      SELECTION-SCREEN: END OF BLOCK b1.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_listheader USING it_listheader.
      PERFORM display_alv_report.
    FORM build_fieldcatlog.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'VBELN'.
      wa_fieldcat-seltext_m = 'SalesOrderNo'.
      wa_fieldcat-outputlen = '12'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Field for Customer Name.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'NAME1'.
      wa_fieldcat-seltext_m = 'Customer Name'.
      wa_fieldcat-outputlen = '30'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Field For Po Number.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'BSTKD'.
      wa_fieldcat-seltext_m = 'PO No'.
      wa_fieldcat-outputlen = '20'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    Field For Order Value
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'NETWR'.
      wa_fieldcat-seltext_m = 'Order Value '.
      wa_fieldcat-outputlen = '12'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Field For Po Date.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'BSTDK'.
      wa_fieldcat-seltext_m = 'PO Date'.
      wa_fieldcat-outputlen = '20'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    wa_fieldcat-tabname = 'ITAB'.
    wa_fieldcat-fieldname = 'POSNR'.
    wa_fieldcat-seltext_m = 'Item No'.
    wa_fieldcat-outputlen = '20'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'EDATU'.
      wa_fieldcat-seltext_m = 'Delivery Date'.
      wa_fieldcat-outputlen = '12'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    wa_fieldcat-tabname = 'VBAP'.
    wa_fieldcat-fieldname = 'KWMENG'.
    wa_fieldcat-seltext_m = 'Order QTY VABP.'.
    wa_fieldcat-outputlen = '14'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.
    Field For Order Qty.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'WMENG'.
      wa_fieldcat-seltext_m = 'Ord.QT.WMEN.'.
      wa_fieldcat-outputlen = '20'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Field For Order Qty.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'BMENG'.
      wa_fieldcat-seltext_m = 'Ord.QT.BMEN.'.
      wa_fieldcat-outputlen = '20'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    field For Delivery Qty.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'LFMING'.
      wa_fieldcat-seltext_m = 'DEL QTY.'.
      wa_fieldcat-outputlen = '20'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Field For Open Qty from ITAB.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'OMENG'.
      wa_fieldcat-seltext_m = 'OPEN QTY.'.
      wa_fieldcat-outputlen = '20'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Field For Pending Weight from ITAB.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'BRGEW'.
      wa_fieldcat-seltext_m = 'Pending Weight'.
      wa_fieldcat-outputlen = '12'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    Field For netweight.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'NTGEW'.
      wa_fieldcat-seltext_m = 'Net Weight'.
      wa_fieldcat-outputlen = '20'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Field For Actual Delivery.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'LFDAT'.
      wa_fieldcat-seltext_m = 'Actual Delivery'.
      wa_fieldcat-outputlen = '12'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'KBETR'.
      wa_fieldcat-seltext_m = 'RATE'.
      wa_fieldcat-outputlen = '20'.
      append wa_fieldcat to i_fieldcat.
      clear wa_fieldcat.
    Field For Actual Delivery.
    wa_fieldcat-tabname = 'LIPS'.
    wa_fieldcat-fieldname = 'POSNR'.
    wa_fieldcat-seltext_m = 'Delivery ITEM'.
    wa_fieldcat-outputlen = '20'.
    append wa_fieldcat to i_fieldcat.
    clear wa_fieldcat.
    Field For Pending Value.
    VBUP-LFSTA
    wa_fieldcat-tabname = 'VBUP'.
    wa_fieldcat-fieldname = 'LFSTA'.
    wa_fieldcat-seltext_m = 'Pending Value'.
    wa_fieldcat-outputlen = '20'.
    append wa_fieldcat to i_fieldcat.
    clear wa_fieldcat.
    Field For pending weight.
    wa_fieldcat-tabname = 'ITAB'.
    wa_fieldcat-fieldname = 'ITAB-OMENG * KOMV-KBETR'.
    wa_fieldcat-seltext_m = 'Pending VALUE'.
    wa_fieldcat-outputlen = '20'.
    APPEND wa_fieldcat TO i_fieldcat.
    CLEAR wa_fieldcat.
    ENDFORM.                    "BUILD_FIELDCATLOG
    FORM data_retrieval.
    SELECT VBELN  NETWR KUNNR FROM VBAK INTO (ITAB-VBELN,ITAB-NETWR,ITAB-KUNNR) WHERE VBELN IN VBELN .
    SELECT POSNR POSAR BRGEW FROM VBAP INTO (ITAB-POSNR,ITAB-POSAR,ITAB-BRGEW) WHERE VBELN = ITAB-VBELN .
    SELECT EDATU FROM VBEP INTO (ITAB-EDATU) WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR.
    SELECT NAME1 FROM KNA1 INTO (ITAB-NAME1) WHERE KUNNR = ITAB-KUNNR .
    SELECT BSTKD BSTDK FROM VBKD INTO (ITAB-BSTKD,ITAB-BSTDK) WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR.
    SELECT VBELN LFIMG FROM LIPS INTO (ITAB-DELIVERY, ITAB-LFIMG) WHERE VGBEL = ITAB-VBELN AND VGPOS = ITAB-POSNR.
    SELECT LFDAT NTGEW FROM LIKP INTO (ITAB-LFDAT,ITAB-NTGEW) WHERE VBELN = ITAB-DELIVERY .
    SELECT WMENG BMENG FROM VBEP INTO (ITAB-WMENG,ITAB-BMENG) WHERE VBELN IN VBELN .
    SELECT SINGLE OMENG FROM VBBE INTO (ITAB-OMENG) WHERE VBELN IN VBELN.
    SELECT SINGLE NETWR FROM VBAK INTO (ITAB-NETWR) WHERE VBELN IN VBELN.
    SELECT KNUMV FROM VBAK INTO (ITAB-KNUMV) WHERE VBELN IN VBELN.
    *SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV) WHERE KNUMV = VBAK-KNUMV.
    *assign VAR1 = itab-kbetr.
    *append itab.
    *ENDSELECT.
    SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV)WHERE KNUMV = VBAK-KNUMV.
    ITAB-KBETR = KONV-KBETR.
    ENDSELECT.
    APPEND ITAB.
    ENDSELECT.
    ENDSELECT.
    ENDSELECT.
    ENDSELECT.
    ENDSELECT.
    ENDSELECT.
    ENDSELECT.
    ENDSELECT.
    ENDSELECT.
    *ENDSELECT.
    ENDFORM.                    "data_retrieval
    FORM build_listheader  USING it_listheader TYPE slis_t_listheader.
    DATA HLINE TYPE SLIS_LISTHEADER.
      DATA: ls_line TYPE slis_listheader.
    bhavesh
    HLINE-INFO = 'report Developed by Bhavesh'.
    HLINE-TYP = 'H'.
    Header
    Bhavesh
      CLEAR ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY: not used for this type
      ls_line-info = 'Sales ORDER Report'.
      APPEND ls_line TO it_listheader.
    bhavesh
    ***Selection
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'Key 1'.
      ls_line-info = 'SFEL'.
      APPEND ls_line TO it_listheader.
      ls_line-key  = 'Key 2'.
      ls_line-info = 'SFEL'.
      APPEND ls_line TO it_listheader.
    ***Action
      CLEAR ls_line.
      ls_line-typ  = 'A'.
    LS_LINE-KEY: not used for this type
      ls_line-info = 'Status list'.
      APPEND ls_line TO it_listheader.
      ENDFORM.                    "BUILD_LISTHEADER
    *ENDFORM.                   "build_listheader
    FORM display_alv_report.
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_repid
       I_CALLBACK_PF_STATUS_SET          = 'STATUS'(002)
         i_callback_user_command           = 'USER_COMMAND'
       i_callback_top_of_page            = 'TOP_OF_PAGE'
         i_grid_title                      = 'SFEL SALES EXPEDITING REPORT'
         i_background_id         = 'ALV_BACKGROUND'
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = LAYO
      IS_LAYOUT                         = ALV_LAYOUT
        it_fieldcat                       = i_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
        I_SAVE                            = 'A'
        is_variant                        = i_variant
        IT_EVENTS                         = V_EVENTS
        TABLES
          t_outtab                          = itab[]
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "display_alv_report
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_listheader[].
         i_logo             = 'ENJOYSAP_LOGO'.
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE

  • Select query in MB51 failing only for posting date(BUDAT)02/02/2010

    Hello Experts,
    I am having below select query.
    It is running perfectly fine for all the dates except 02/02/2010.On all other dates it is getting executed with in second.
    For 02/02/2010 it keeps on running for more than 10 minutes and then fails with timeout error.
    Please let me know if anyone know any solution for this.
    select (g_t_fields)
        into corresponding fields of table itab
        from mkpf inner join mseg
        on    mkpfmandt = msegmandt
          and mkpfmblnr = msegmblnr
          and mkpfmjahr = msegmjahr
           WHERE MKPF~BUDAT in BUDAT
             and MSEG~BWART in BWART
             and MSEG~CHARG in CHARG
             and MKPF~FRBNR in FRBNR
             and MSEG~KUNNR in KUNNR
             and MSEG~LGORT in LGORT
             and MSEG~LIFNR in LIFNR
             and MSEG~MATNR in MATNR
             and MSEG~SOBKZ in SOBKZ
             and MKPF~USNAM in USNAM
             and MKPF~VGART in VGART
             and MSEG~WERKS in WERKS
             and MKPF~XBLNR in XBLNR
    %_HINTS
    ORACLE '&SUBSTITUTE VALUES&'
    Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting and please use code tags when posting code - post locked
    Edited by: Rob Burbank on Feb 4, 2010 9:02 AM

    Hi Sameer,
    Please check on which date the production order has status as "completed".
    It could be on 01.02.2015.
    Thanks,
    Vimal

  • Getting deadlock detected while waiting for resource error for select Query.....

    Hi all,
    i am getting a below error whenever executing the below select query....
    some times it will show dead lock detected while waiting for resource and terminated...
    some times it executes and gives result..
    but all the time it writes an alert to alert log
    Plesae suggest how to resolve the issue..........
    Thanks in advance
    Env: Linux / Oracle 11.2.0.3.3
    Error from alert log:
    Errors in file /u01/oracle/oracle/diag/rdbms/bdrdb/bdrdb/trace/bdrdb_p017_6076.trc:
    ORA-00060: deadlock detected while waiting for resource
    ORA-10387: parallel query server interrupt (normal)
    Trace file info... bdrdb_p017_6076.trc:
    Trace file /u01/oracle/oracle/diag/rdbms/bdrdb/bdrdb/trace/bdrdb_p017_6076.trc
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    ORACLE_HOME = /u01/oracle/oracle/product/11.2.0/dbhome_1
    System name:    Linux
    Node name:      bdrdb.cteplindia.com
    Release:        2.6.18-308.el5PAE
    Version:        #1 SMP Fri Jan 27 17:40:09 EST 2012
    Machine:        i686
    Instance name: bdrdb
    Redo thread mounted by this instance: 1
    Oracle process number: 92
    Unix process pid: 6076, image: [email protected] (P017)
    *** 2013-11-04 23:18:57.915
    *** SESSION ID:(423.59970) 2013-11-04 23:18:57.915
    *** CLIENT ID:() 2013-11-04 23:18:57.915
    *** SERVICE NAME:(bdrdb) 2013-11-04 23:18:57.915
    *** MODULE NAME:() 2013-11-04 23:18:57.915
    *** ACTION NAME:() 2013-11-04 23:18:57.915
    *** 2013-11-04 23:18:57.915
    DEADLOCK DETECTED ( ORA-00060 )
    [Transaction Deadlock]
    Deadlock graph:
                           ---------Blocker(s)--------  ---------Waiter(s)---------
    Resource Name          process session holds waits  process session holds waits
    PS-00000001-00000011        92     423     S             33     128     S     X
    BF-2ed08c01-00000000        33     128     S             92     423     S     X
    session 423: DID 0001-005C-00081126     session 128: DID 0001-0021-00067D23
    session 128: DID 0001-0021-00067D23     session 423: DID 0001-005C-00081126
    DEADLOCK DETECTED ( ORA-00060 )
    [Transaction Deadlock]
    Deadlock graph:
                           ---------Blocker(s)--------  ---------Waiter(s)---------
    Resource Name          process session holds waits  process session holds waits
    PS-00000001-00000011        92     423     S             33     128     S     X
    BF-2ed08c01-00000000        33     128     S             92     423     S     X
    session 423: DID 0001-005C-00081126     session 128: DID 0001-0021-00067D23
    session 128: DID 0001-0021-00067D23     session 423: DID 0001-005C-00081126
    Rows waited on:
      Session 423: no row
      Session 128: obj - rowid = 00021DC1 - AAAh3BAAVAAAQL/AAA
      (dictionary objn - 138689, file - 21, block - 66303, slot - 0)
    ----- Information for the OTHER waiting sessions -----
    Session 128:
      sid: 128 ser: 46176 audsid: 1836857 user: 102/DBLOCAL
        flags: (0x8000041) USR/- flags_idl: (0x1) BSY/-/-/-/-/-
        flags2: (0x40009) -/-/INC
      pid: 33 O/S info: user: oracle, term: UNKNOWN, ospid: 31611
        image: [email protected]
      client details:
        O/S info: user: masked, term: masked, ospid: 5924:568
        machine: masked program: Toad.exe
        application name: TOAD background query session, hash value=526966934
      current SQL:
        application name: TOAD background query session, hash value=526966934
      current SQL:
      SELECT  DISTINCT B_FP_TEST.TEST_ID
      FROM B_FP_TEST,
           B_USER_INFO,
           J_FP_INVESTIGATOR,
           L_TEST_STATUS,
           L_ATMS_TEST_TYPE,
           j_op_test_anml
    WHERE     B_FP_TEST.TEST_ID = J_FP_INVESTIGATOR.TEST_ID
           AND B_FP_TEST.TEST_TYPE_ID = L_ATMS_TEST_TYPE.ATMS_TEST_TYPE_ID
           AND B_USER_INFO.B_USER_INFO_ID = J_FP_INVESTIGATOR.INVESTIGATOR_ID
           AND B_FP_TEST.STATUS_ID = L_TEST_STATUS.STATUS_ID
           AND B_FP_TEST.IS_DELETED = :"SYS_B_00"
           AND B_FP_TEST.TEST_NUM NOT IN (:"SYS_B_01", :"SYS_B_02", :"SYS_B_03")
           AND L_ATMS_TEST_TYPE.IS_DELETED = :"SYS_B_04"
           AND J_FP_INVESTIGATOR.is_pi = :"SYS_B_05"
           AND L_TEST_STATUS.STATUS IN (:"SYS_B_06", :"SYS_B_07", :"SYS_B_08")
           AND j_op_test_anml.test_id = B_FP_TEST.TEST_ID
    ----- End of information for the OTHER waiting sessions -----
    *** 2013-11-04 23:18:57.916
    dbkedDefDump(): Starting a non-incident diagnostic dump (flags=0x0, level=3, mask=0x0)
    ----- Error Stack Dump -----
    ORA-00060: deadlock detected while waiting for resource
    ORA-10387: parallel query server interrupt (normal)
    ----- SQL Statement (None) -----
    Current SQL information unavailable - no cursor.
    ----- Call Stack Trace -----
    calling              call     entry                argument values in hex
    location             type     point                (? means dubious value)
    More......
    Query:
    SELECT DISTINCT B_FP_TEST.TEST_ID
      FROM B_FP_TEST,
           B_USER_INFO,
           J_FP_INVESTIGATOR,
           L_TEST_STATUS,
           L_ATMS_TEST_TYPE,
           j_op_test_anml
    WHERE     B_FP_TEST.TEST_ID = J_FP_INVESTIGATOR.TEST_ID
           AND B_FP_TEST.TEST_TYPE_ID = L_ATMS_TEST_TYPE.ATMS_TEST_TYPE_ID
           AND B_USER_INFO.B_USER_INFO_ID = J_FP_INVESTIGATOR.INVESTIGATOR_ID
           AND B_FP_TEST.STATUS_ID = L_TEST_STATUS.STATUS_ID
           AND B_FP_TEST.IS_DELETED = 0
           AND B_FP_TEST.TEST_NUM NOT IN (1, 2, 99)
           AND L_ATMS_TEST_TYPE.IS_DELETED = 0
           AND J_FP_INVESTIGATOR.is_pi = 1
           AND L_TEST_STATUS.STATUS IN ('Scheduled', 'In-Progress', 'Completed')
           AND j_op_test_anml.test_id = B_FP_TEST.TEST_ID
           AND (   (j_op_test_anml.end_date BETWEEN TO_DATE ('28-Oct-2013') - 1
                                                AND TO_DATE ('04-Nov-2013') + 1)
                OR (j_op_test_anml.start_date BETWEEN TO_DATE ('28-Oct-2013') - 1
                                                  AND TO_DATE ('04-Nov-2013') + 1)
                OR (TO_DATE ('28-Oct-2013') BETWEEN j_op_test_anml.start_date
                                                AND j_op_test_anml.end_date)
                OR (TO_DATE ('04-Nov-2013') BETWEEN j_op_test_anml.start_date
                                                AND j_op_test_anml.end_date))
           AND L_ATMS_TEST_TYPE.IS_DELETED = 0
           AND B_FP_TEST.DATASOURCE_ID = 9
    Query Exp plan:
    Plan hash value: 3398228788
    | Id  | Operation                                          | Name                | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT                                   |                     |  1501 |   102K|  1929   (1)| 00:00:24 |       |       |        |      |            |
    |   1 |  HASH UNIQUE                                       |                     |  1501 |   102K|  1929   (1)| 00:00:24 |       |       |        |      |            |
    |   2 |   CONCATENATION                                    |                     |       |       |            |          |       |       |        |      |            |
    |   3 |    PX COORDINATOR                                  |                     |       |       |            |          |       |       |        |      |            |
    |   4 |     PX SEND QC (RANDOM)                            | :TQ30005            |   241 | 16870 |   800   (1)| 00:00:10 |       |       |  Q3,05 | P->S | QC (RAND)  |
    |*  5 |      HASH JOIN                                     |                     |   241 | 16870 |   800   (1)| 00:00:10 |       |       |  Q3,05 | PCWP |            |
    |   6 |       PX RECEIVE                                   |                     |   246 | 15990 |   797   (1)| 00:00:10 |       |       |  Q3,05 | PCWP |            |
    |   7 |        PX SEND HASH                                | :TQ30004            |   246 | 15990 |   797   (1)| 00:00:10 |       |       |  Q3,04 | P->P | HASH       |
    |*  8 |         HASH JOIN                                  |                     |   246 | 15990 |   797   (1)| 00:00:10 |       |       |  Q3,04 | PCWP |            |
    |   9 |          PX RECEIVE                                |                     |   573 | 29223 |   793   (1)| 00:00:10 |       |       |  Q3,04 | PCWP |            |
    |  10 |           PX SEND HASH                             | :TQ30003            |   573 | 29223 |   793   (1)| 00:00:10 |       |       |  Q3,03 | P->P | HASH       |
    |* 11 |            HASH JOIN                               |                     |   573 | 29223 |   793   (1)| 00:00:10 |       |       |  Q3,03 | PCWP |            |
    |  12 |             BUFFER SORT                            |                     |       |       |            |          |       |       |  Q3,03 | PCWC |            |
    |  13 |              PX RECEIVE                            |                     |       |       |            |          |       |       |  Q3,03 | PCWP |            |
    |  14 |               PX SEND BROADCAST                    | :TQ30000            |       |       |            |          |       |       |        | S->P | BROADCAST  |
    |  15 |                NESTED LOOPS                        |                     |       |       |            |          |       |       |        |      |            |
    |  16 |                 NESTED LOOPS                       |                     |   485 | 20855 |   781   (0)| 00:00:10 |       |       |        |      |            |
    |  17 |                  TABLE ACCESS BY GLOBAL INDEX ROWID| J_OP_TEST_ANML      |   485 | 10185 |   296   (0)| 00:00:04 | ROWID | ROWID |        |      |            |
    |* 18 |                   INDEX RANGE SCAN                 | IDX$$_2D190001      |   485 |       |     4   (0)| 00:00:01 |       |       |        |      |            |
    |* 19 |                  INDEX UNIQUE SCAN                 | FT_TEST_ID_PK       |     1 |       |     0   (0)| 00:00:01 |       |       |        |      |            |
    |* 20 |                 TABLE ACCESS BY GLOBAL INDEX ROWID | B_FP_TEST           |     1 |    22 |     1   (0)| 00:00:01 | ROWID | ROWID |        |      |            |
    |  21 |             PX BLOCK ITERATOR                      |                     | 70382 |   549K|    11   (0)| 00:00:01 |       |       |  Q3,03 | PCWC |            |
    |* 22 |              TABLE ACCESS FULL                     | J_FP_INVESTIGATOR   | 70382 |   549K|    11   (0)| 00:00:01 |       |       |  Q3,03 | PCWP |            |
    |  23 |          BUFFER SORT                               |                     |       |       |            |          |       |       |  Q3,04 | PCWC |            |
    |  24 |           PX RECEIVE                               |                     |     3 |    42 |     3   (0)| 00:00:01 |       |       |  Q3,04 | PCWP |            |
    |  25 |            PX SEND HASH                            | :TQ30001            |     3 |    42 |     3   (0)| 00:00:01 |       |       |        | S->P | HASH       |
    |* 26 |             TABLE ACCESS FULL                      | L_TEST_STATUS       |     3 |    42 |     3   (0)| 00:00:01 |       |       |        |      |            |
    |  27 |       BUFFER SORT                                  |                     |       |       |            |          |       |       |  Q3,05 | PCWC |            |
    |  28 |        PX RECEIVE                                  |                     |    30 |   150 |     3   (0)| 00:00:01 |       |       |  Q3,05 | PCWP |            |
    |  29 |         PX SEND HASH                               | :TQ30002            |    30 |   150 |     3   (0)| 00:00:01 |       |       |        | S->P | HASH       |
    |* 30 |          TABLE ACCESS FULL                         | L_ATMS_TEST_TYPE    |    30 |   150 |     3   (0)| 00:00:01 |       |       |        |      |            |
    |  31 |    NESTED LOOPS                                    |                     |       |       |            |          |       |       |        |      |            |
    |  32 |     NESTED LOOPS                                   |                     |     3 |   210 |   329   (1)| 00:00:04 |       |       |        |      |            |
    |  33 |      NESTED LOOPS                                  |                     |     3 |   195 |   329   (1)| 00:00:04 |       |       |        |      |            |
    |* 34 |       HASH JOIN                                    |                     |     2 |   114 |   325   (1)| 00:00:04 |       |       |        |      |            |
    |  35 |        NESTED LOOPS                                |                     |       |       |            |          |       |       |        |      |            |
    |  36 |         NESTED LOOPS                               |                     |     6 |   258 |   322   (1)| 00:00:04 |       |       |        |      |            |
    |  37 |          PARTITION RANGE SINGLE                    |                     |     6 |   126 |   316   (1)| 00:00:04 |     7 |     7 |        |      |            |
    |* 38 |           TABLE ACCESS FULL                        | J_OP_TEST_ANML      |     6 |   126 |   316   (1)| 00:00:04 |     7 |     7 |        |      |            |
    |* 39 |          INDEX UNIQUE SCAN                         | FT_TEST_ID_PK       |     1 |       |     0   (0)| 00:00:01 |       |       |        |      |            |
    |* 40 |         TABLE ACCESS BY GLOBAL INDEX ROWID         | B_FP_TEST           |     1 |    22 |     1   (0)| 00:00:01 | ROWID | ROWID |        |      |            |
    |* 41 |        TABLE ACCESS FULL                           | L_TEST_STATUS       |     3 |    42 |     3   (0)| 00:00:01 |       |       |        |      |            |
    |* 42 |       TABLE ACCESS BY INDEX ROWID                  | J_FP_INVESTIGATOR   |     1 |     8 |     2   (0)| 00:00:01 |       |       |        |      |            |
    |* 43 |        INDEX RANGE SCAN                            | FI_TEST_ID_PK       |     1 |       |     1   (0)| 00:00:01 |       |       |        |      |            |
    |* 44 |      INDEX UNIQUE SCAN                             | L_ATMS_TEST_TYPE_PK |     1 |       |     0   (0)| 00:00:01 |       |       |        |      |            |
    |* 45 |     TABLE ACCESS BY INDEX ROWID                    | L_ATMS_TEST_TYPE    |     1 |     5 |     1   (0)| 00:00:01 |       |       |        |      |            |
    |  46 |    PX COORDINATOR                                  |                     |       |       |            |          |       |       |        |      |            |
    |  47 |     PX SEND QC (RANDOM)                            | :TQ20003            |       |       |            |          |       |       |  Q2,03 | P->S | QC (RAND)  |
    |  48 |      NESTED LOOPS                                  |                     |       |       |            |          |       |       |  Q2,03 | PCWP |            |
    |  49 |       NESTED LOOPS                                 |                     |    33 |  2310 |   399   (2)| 00:00:05 |       |       |  Q2,03 | PCWP |            |
    |* 50 |        HASH JOIN                                   |                     |    33 |  2145 |   397   (2)| 00:00:05 |       |       |  Q2,03 | PCWP |            |
    |  51 |         PX RECEIVE                                 |                     |    78 |  3978 |   393   (1)| 00:00:05 |       |       |  Q2,03 | PCWP |            |
    |  52 |          PX SEND HASH                              | :TQ20002            |    78 |  3978 |   393   (1)| 00:00:05 |       |       |  Q2,02 | P->P | HASH       |
    |* 53 |           HASH JOIN                                |                     |    78 |  3978 |   393   (1)| 00:00:05 |       |       |  Q2,02 | PCWP |            |
    |  54 |            BUFFER SORT                             |                     |       |       |            |          |       |       |  Q2,02 | PCWC |            |
    |  55 |             PX RECEIVE                             |                     |       |       |            |          |       |       |  Q2,02 | PCWP |            |
    |  56 |              PX SEND BROADCAST                     | :TQ20000            |       |       |            |          |       |       |        | S->P | BROADCAST  |
    |  57 |               NESTED LOOPS                         |                     |       |       |            |          |       |       |        |      |            |
    |  58 |                NESTED LOOPS                        |                     |    66 |  2838 |   382   (1)| 00:00:05 |       |       |        |      |            |
    |  59 |                 PARTITION RANGE SINGLE             |                     |    66 |  1386 |   316   (1)| 00:00:04 |     7 |     7 |        |      |            |
    |* 60 |                  TABLE ACCESS FULL                 | J_OP_TEST_ANML      |    66 |  1386 |   316   (1)| 00:00:04 |     7 |     7 |        |      |            |
    |* 61 |                 INDEX UNIQUE SCAN                  | FT_TEST_ID_PK       |     1 |       |     0   (0)| 00:00:01 |       |       |        |      |            |
    |* 62 |                TABLE ACCESS BY GLOBAL INDEX ROWID  | B_FP_TEST           |     1 |    22 |     1   (0)| 00:00:01 | ROWID | ROWID |        |      |            |
    |  63 |            PX BLOCK ITERATOR                       |                     | 70382 |   549K|    11   (0)| 00:00:01 |       |       |  Q2,02 | PCWC |            |
    |* 64 |             TABLE ACCESS FULL                      | J_FP_INVESTIGATOR   | 70382 |   549K|    11   (0)| 00:00:01 |       |       |  Q2,02 | PCWP |            |
    |  65 |         BUFFER SORT                                |                     |       |       |            |          |       |       |  Q2,03 | PCWC |            |
    |  66 |          PX RECEIVE                                |                     |     3 |    42 |     3   (0)| 00:00:01 |       |       |  Q2,03 | PCWP |            |
    |  67 |           PX SEND HASH                             | :TQ20001            |     3 |    42 |     3   (0)| 00:00:01 |       |       |        | S->P | HASH       |
    |* 68 |            TABLE ACCESS FULL                       | L_TEST_STATUS       |     3 |    42 |     3   (0)| 00:00:01 |       |       |        |      |            |
    |* 69 |        INDEX UNIQUE SCAN                           | L_ATMS_TEST_TYPE_PK |     1 |       |     0   (0)| 00:00:01 |       |       |  Q2,03 | PCWP |            |
    |* 70 |       TABLE ACCESS BY INDEX ROWID                  | L_ATMS_TEST_TYPE    |     1 |     5 |     1   (0)| 00:00:01 |       |       |  Q2,03 | PCWP |            |
    |  71 |    PX COORDINATOR                                  |                     |       |       |            |          |       |       |        |      |            |
    |  72 |     PX SEND QC (RANDOM)                            | :TQ10003            |       |       |            |          |       |       |  Q1,03 | P->S | QC (RAND)  |
    |  73 |      NESTED LOOPS                                  |                     |       |       |            |          |       |       |  Q1,03 | PCWP |            |
    |  74 |       NESTED LOOPS                                 |                     |    33 |  2310 |   399   (2)| 00:00:05 |       |       |  Q1,03 | PCWP |            |
    |* 75 |        HASH JOIN                                   |                     |    34 |  2210 |   397   (2)| 00:00:05 |       |       |  Q1,03 | PCWP |            |
    |  76 |         PX RECEIVE                                 |                     |    78 |  3978 |   393   (1)| 00:00:05 |       |       |  Q1,03 | PCWP |            |
    |  77 |          PX SEND HASH                              | :TQ10002            |    78 |  3978 |   393   (1)| 00:00:05 |       |       |  Q1,02 | P->P | HASH       |
    |* 78 |           HASH JOIN                                |                     |    78 |  3978 |   393   (1)| 00:00:05 |       |       |  Q1,02 | PCWP |            |
    |  79 |            BUFFER SORT                             |                     |       |       |            |          |       |       |  Q1,02 | PCWC |            |
    |  80 |             PX RECEIVE                             |                     |       |       |            |          |       |       |  Q1,02 | PCWP |            |
    |  81 |              PX SEND BROADCAST                     | :TQ10000            |       |       |            |          |       |       |        | S->P | BROADCAST  |
    |  82 |               NESTED LOOPS                         |                     |       |       |            |          |       |       |        |      |            |
    |  83 |                NESTED LOOPS                        |                     |    66 |  2838 |   382   (1)| 00:00:05 |       |       |        |      |            |
    |  84 |                 PARTITION RANGE SINGLE             |                     |    66 |  1386 |   316   (1)| 00:00:04 |     7 |     7 |        |      |            |
    |* 85 |                  TABLE ACCESS FULL                 | J_OP_TEST_ANML      |    66 |  1386 |   316   (1)| 00:00:04 |     7 |     7 |        |      |            |
    |* 86 |                 INDEX UNIQUE SCAN                  | FT_TEST_ID_PK       |     1 |       |     0   (0)| 00:00:01 |       |       |        |      |            |
    |* 87 |                TABLE ACCESS BY GLOBAL INDEX ROWID  | B_FP_TEST           |     1 |    22 |     1   (0)| 00:00:01 | ROWID | ROWID |        |      |            |
    |  88 |            PX BLOCK ITERATOR                       |                     | 70382 |   549K|    11   (0)| 00:00:01 |       |       |  Q1,02 | PCWC |            |
    |* 89 |             TABLE ACCESS FULL                      | J_FP_INVESTIGATOR   | 70382 |   549K|    11   (0)| 00:00:01 |       |       |  Q1,02 | PCWP |            |
    |  90 |         BUFFER SORT                                |                     |       |       |            |          |       |       |  Q1,03 | PCWC |            |
    |  91 |          PX RECEIVE                                |                     |     3 |    42 |     3   (0)| 00:00:01 |       |       |  Q1,03 | PCWP |            |
    |  92 |           PX SEND HASH                             | :TQ10001            |     3 |    42 |     3   (0)| 00:00:01 |       |       |        | S->P | HASH       |
    |* 93 |            TABLE ACCESS FULL                       | L_TEST_STATUS       |     3 |    42 |     3   (0)| 00:00:01 |       |       |        |      |            |
    |* 94 |        INDEX UNIQUE SCAN                           | L_ATMS_TEST_TYPE_PK |     1 |       |     0   (0)| 00:00:01 |       |       |  Q1,03 | PCWP |            |
    |* 95 |       TABLE ACCESS BY INDEX ROWID                  | L_ATMS_TEST_TYPE    |     1 |     5 |     1   (0)| 00:00:01 |       |       |  Q1,03 | PCWP |            |
    Predicate Information (identified by operation id):
       5 - access("B_FP_TEST"."TEST_TYPE_ID"="L_ATMS_TEST_TYPE"."ATMS_TEST_TYPE_ID")
       8 - access("B_FP_TEST"."STATUS_ID"="L_TEST_STATUS"."STATUS_ID")
      11 - access("B_FP_TEST"."TEST_ID"="J_FP_INVESTIGATOR"."TEST_ID")
      18 - access("J_OP_TEST_ANML"."START_DATE">=TO_DATE(' 2013-10-27 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "J_OP_TEST_ANML"."START_DATE"<=TO_DATE(' 2013-11-05
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      19 - access("J_OP_TEST_ANML"."TEST_ID"="B_FP_TEST"."TEST_ID")
      20 - filter("B_FP_TEST"."DATASOURCE_ID"=9 AND "B_FP_TEST"."IS_DELETED"=0 AND "B_FP_TEST"."TEST_NUM"<>1 AND "B_FP_TEST"."TEST_NUM"<>2 AND
                  "B_FP_TEST"."TEST_NUM"<>99)
      22 - filter("J_FP_INVESTIGATOR"."IS_PI"=1)
      26 - filter("L_TEST_STATUS"."STATUS"='Completed' OR "L_TEST_STATUS"."STATUS"='In-Progress' OR "L_TEST_STATUS"."STATUS"='Scheduled')
      30 - filter("L_ATMS_TEST_TYPE"."IS_DELETED"=0)
      34 - access("B_FP_TEST"."STATUS_ID"="L_TEST_STATUS"."STATUS_ID")
      38 - filter("J_OP_TEST_ANML"."END_DATE">=TO_DATE(' 2013-10-27 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "J_OP_TEST_ANML"."END_DATE"<=TO_DATE(' 2013-11-05
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND (LNNVL("J_OP_TEST_ANML"."START_DATE">=TO_DATE(' 2013-10-27 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) OR
                  LNNVL("J_OP_TEST_ANML"."START_DATE"<=TO_DATE(' 2013-11-05 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))))
      39 - access("J_OP_TEST_ANML"."TEST_ID"="B_FP_TEST"."TEST_ID")
      40 - filter("B_FP_TEST"."DATASOURCE_ID"=9 AND "B_FP_TEST"."IS_DELETED"=0 AND "B_FP_TEST"."TEST_NUM"<>1 AND "B_FP_TEST"."TEST_NUM"<>2 AND
                  "B_FP_TEST"."TEST_NUM"<>99)
      41 - filter("L_TEST_STATUS"."STATUS"='Completed' OR "L_TEST_STATUS"."STATUS"='In-Progress' OR "L_TEST_STATUS"."STATUS"='Scheduled')
      42 - filter("J_FP_INVESTIGATOR"."IS_PI"=1)
      43 - access("B_FP_TEST"."TEST_ID"="J_FP_INVESTIGATOR"."TEST_ID")
      44 - access("B_FP_TEST"."TEST_TYPE_ID"="L_ATMS_TEST_TYPE"."ATMS_TEST_TYPE_ID")
      45 - filter("L_ATMS_TEST_TYPE"."IS_DELETED"=0)
      50 - access("B_FP_TEST"."STATUS_ID"="L_TEST_STATUS"."STATUS_ID")
      53 - access("B_FP_TEST"."TEST_ID"="J_FP_INVESTIGATOR"."TEST_ID")
      60 - filter("J_OP_TEST_ANML"."END_DATE">=TO_DATE(' 2013-11-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "J_OP_TEST_ANML"."START_DATE"<=TO_DATE(' 2013-11-04
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND (LNNVL("J_OP_TEST_ANML"."END_DATE">=TO_DATE(' 2013-10-27 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) OR
                  LNNVL("J_OP_TEST_ANML"."END_DATE"<=TO_DATE(' 2013-11-05 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))) AND (LNNVL("J_OP_TEST_ANML"."START_DATE">=TO_DATE(' 2013-10-27
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss')) OR LNNVL("J_OP_TEST_ANML"."START_DATE"<=TO_DATE(' 2013-11-05 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))))
      61 - access("J_OP_TEST_ANML"."TEST_ID"="B_FP_TEST"."TEST_ID")
      62 - filter("B_FP_TEST"."DATASOURCE_ID"=9 AND "B_FP_TEST"."IS_DELETED"=0 AND "B_FP_TEST"."TEST_NUM"<>1 AND "B_FP_TEST"."TEST_NUM"<>2 AND
                  "B_FP_TEST"."TEST_NUM"<>99)
      64 - filter("J_FP_INVESTIGATOR"."IS_PI"=1)
      68 - filter("L_TEST_STATUS"."STATUS"='Completed' OR "L_TEST_STATUS"."STATUS"='In-Progress' OR "L_TEST_STATUS"."STATUS"='Scheduled')
      69 - access("B_FP_TEST"."TEST_TYPE_ID"="L_ATMS_TEST_TYPE"."ATMS_TEST_TYPE_ID")
      70 - filter("L_ATMS_TEST_TYPE"."IS_DELETED"=0)
      75 - access("B_FP_TEST"."STATUS_ID"="L_TEST_STATUS"."STATUS_ID")
      78 - access("B_FP_TEST"."TEST_ID"="J_FP_INVESTIGATOR"."TEST_ID")
      85 - filter("J_OP_TEST_ANML"."END_DATE">=TO_DATE(' 2013-10-28 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "J_OP_TEST_ANML"."START_DATE"<=TO_DATE(' 2013-10-28
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND (LNNVL("J_OP_TEST_ANML"."END_DATE">=TO_DATE(' 2013-11-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) OR
                  LNNVL("J_OP_TEST_ANML"."START_DATE"<=TO_DATE(' 2013-11-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))) AND (LNNVL("J_OP_TEST_ANML"."END_DATE">=TO_DATE(' 2013-10-27
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss')) OR LNNVL("J_OP_TEST_ANML"."END_DATE"<=TO_DATE(' 2013-11-05 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))) AND
                  (LNNVL("J_OP_TEST_ANML"."START_DATE">=TO_DATE(' 2013-10-27 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) OR LNNVL("J_OP_TEST_ANML"."START_DATE"<=TO_DATE(' 2013-11-05
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss'))))
      86 - access("J_OP_TEST_ANML"."TEST_ID"="B_FP_TEST"."TEST_ID")
      87 - filter("B_FP_TEST"."DATASOURCE_ID"=9 AND "B_FP_TEST"."IS_DELETED"=0 AND "B_FP_TEST"."TEST_NUM"<>1 AND "B_FP_TEST"."TEST_NUM"<>2 AND
                  "B_FP_TEST"."TEST_NUM"<>99)
      89 - filter("J_FP_INVESTIGATOR"."IS_PI"=1)
      93 - filter("L_TEST_STATUS"."STATUS"='Completed' OR "L_TEST_STATUS"."STATUS"='In-Progress' OR "L_TEST_STATUS"."STATUS"='Scheduled')
      94 - access("B_FP_TEST"."TEST_TYPE_ID"="L_ATMS_TEST_TYPE"."ATMS_TEST_TYPE_ID")
      95 - filter("L_ATMS_TEST_TYPE"."IS_DELETED"=0)

    Excellent piece of follow-up on my first suggestion.
    I nearly made a comment about how the plan doesn't show Bloom filter pruning either - and then I realised why not. The plan you've shown us comes from Explain Plan with literal values present; the trace file shows bind variables with names that are generated when cursor_sharing is set to force or similar - so the run-time plan and the plan from explain plan are almost guaranteed to be different.
    Oracle support will need you to supply the plan you get from trying to run the query and then making a call to dbms_xplan.display_cursor() - dbms_xplan in 10g | Oracle Scratchpad If you do this I think you'll find that the pstart/pstop columns contain entries like :BF0000, and you may even find operations link PX JOIN FILTER CREATE / PX JOIN FILTER USE
    A couple of generic notes:
    if a query does sufficient work to merit parallel execution, then it's usually better to supply the best possible information to the optimizer, which means using literals rather than bind variables - you could try executing the query with the hint /*+ cursor_sharing_exact */ to stop Oracle from turning your literals into binds; it might be the presence of bind variables that's making the optimizer choose a path that has to include bloom filter pruning in your case.
    Where you have the to_date() call you've used a four-digit year - which is a very good thing and helps the optimizer - but it's also a good idea to include an explicit format string as well: with a four-digit year this probably won't make any difference, but it avoids any risk of ambiguity for the optimizer.
    I made a comment about the P->S stage and bottlenecks - I spent a couple more minutes looking at the plan, and I see the optimizer has used concatentation: in effect it has run three query blocks one after the other and fed the results to the query co-ordinator - in this case the P->S would make no difference to the end-user response time there's always a final P->S to the coordinator, you just happen to have three of them.
    Regards
    Jonathan Lewis

  • Sinlge select query in different schemas for same table(Indentical Structu)

    Scenario :
    Table XYZ is created in Schema A
    After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
    For eg
    Schema A contains table XYZ with data of 2012 yr
    Schema B contains table XYZ with data of 2011 yr
    Table XYZ in both the schemas have identical structure.
    So can we fire a single select query to read the data from both the tables in effective way.
    Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
    However the data resides in 2 different schema altogether.

    Thanks for the reply
    Creating an view is an option.
    But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
    So the queries would be formed by the ORM layer and are not hand generated.
    So i cannot use view.
    So is there any option that would allow me to use single query on different schema's ?

  • Sinlge select query in diff schemas for same table(Indentical Structure)

    Scenario :
    Table XYZ is created in Schema A
    After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
    For eg
    Schema A contains table XYZ with data of 2012 yr
    Schema B contains table XYZ with data of 2011 yr
    Table XYZ in both the schemas have identical structure.
    So can we fire a single select query to read the data from both the tables in effective way.
    Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
    However the data resides in 2 different schema altogether.
    Creating an view is an option.
    But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
    So the queries would be formed by the ORM layer and are not hand generated.
    So i cannot use view.
    So is there any option that would allow me to use single query on different schema's ?

    Hi,
    970773 wrote:
    Scenario :
    Table XYZ is created in Schema A
    After an year, the old data from the previous year would be moved to different schema. However in the other schema the same table name would be used.
    For eg
    Schema A contains table XYZ with data of 2012 yr
    Schema B contains table XYZ with data of 2011 yr
    Table XYZ in both the schemas have identical structure.
    So can we fire a single select query to read the data from both the tables in effective way.That depends on what you mean by "effective".
    Eg select * from XYZ where date range between 15-Oct-2011 to 15-Mar-2012.
    However the data resides in 2 different schema altogether.You can do a UNION, so the data from the two years appears together. The number of actual tables may make the query slower, but it won;t change the results.
    Given that you have 2 tables, the fact that they are in different schemas doesn't matter. Just make sure the user running the query has SELECT privileges on both of them.
    Creating an view is an option.Is it? You seem to say it is not, below.
    But my problem, there is ORM layer(either Hibernate or Eclipse Top Link) between the application and the database.
    So the queries would be formed by the ORM layer and are not hand generated.
    So i cannot use view.So creating a view is not an option. Or is it?
    So is there any option that would allow me to use single query on different schema's ?Anything that you can do with a view, you can do with sub-queries. A view is merely a convenience; it just saves a sub-query, so you don't have to re-code it every time you use it. Assuming you have privilges to query the base tables, you can always avoid using a view by repeating the query that defines the view in your own query. It will not be any slower

  • I need to know the proper syntax for my SELECT query, please.

    Hello All,
    Quick one for you:
    Let's say that I have several columns in a table with names such as subject_1, subject_2, subject_3, etc. The table's name is subject_names.
    The number in each of the three column name examples is also a value passed along a query string, the user can select choices, 1, 2 or 3. That query string's variable is $qs.
    So, what I want is a SELECT query that uses the query string value as follows (KEEP IN MIND, I know this is not the proper syntax):
    "SELECT subject_[$qs]
    FROM subject_names";
    I have tried all sorts of cominations of quotes (single and double), dots, brackets, braces and parenthesis. I just want to know how to include such a variable within this code.
    Any and all help is sincerely appreciated!
    Cheers,
    wordman

    Well, I did give you the syntax though.
    $query = 'SELECT ' . $qs . ' FROM tbl_name';
    I put spaces between the periods this time to make it more clear.
    If you put the actual word 'subject' in there and just want your form to name it's options as the numbers available you could do this:
    $query = 'SELECT subject_' . $qs . ' FROM tbl_name';
    In PHP you can use either single or double quotes around your query string, I always just use single quotes. I see a lot of other use double quotes.
    Double quotes would look like:
    $query = "SELECT subject_' . $qs . ' FROM tbl_name";
    Or when using double quotes you can actually just place the variable right in the string without having to concatenate multiple strings like above.
    Since you mentioned that you are good with passing variables I probably don't have to mention that you need to set the value attribute of your option tags (if you are using a select) to the value you want them to pass.
    Ex:
    <select name="choices">
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
    </select>
    If you have that part all figured out then you can use the syntax above for your query string.
    Good luck.

  • OPtimizing Performance for Select query on NAST table

    Hi All,
       We are fetching a single record from NAST table. The table has around 10 Million Entries.
       The Select Query takes around 5-6 minutes to return.
       We are not using the Primary key completely. We are using only one field of the primary key.
        The field is also a part of the Index but we are not using all the fields in the index as well.
        We need to bring down the time. What can be the solution? I cant see any changes to the code, since its a single query and we cant use the Entire Primary key.
       Would creating an Index on the fields that we are concerned with help in this regard.
       Open to all solutions.
    Thanks in Advance,
    Imran

    Hi,
    Please check this thread
    http://sap.ittoolbox.com/documents/popular-q-and-a/specifying-the-index-to-be-used-2462
    For creating another secondary index in NAST whether basis will approve for this?
    aRs

  • Performance improvement for select query

    Hi all,
    need to improve performace for the below select query as it is taking long time
    SELECT vbeln pdstk
             FROM vbuk INTO TABLE it_vbuk1 FOR ALL ENTRIES IN it_likp
          WHERE vbeln = it_likp-vbeln       AND
                wbstk = 'C'  AND "pdstk = ' ' AND
                vbtyp IN gr_delivery AND
                ( fkstk = 'A' OR fkstk = 'B' ) OR
                ( fkivk = 'A' OR fkivk = 'B' ).
    Regards,
    Kumar

    Hi,
        Check if it_likp is sorted on vbeln.
    SELECT vbeln pdstk
    FROM vbuk INTO TABLE it_vbuk1 FOR ALL ENTRIES IN it_likp
    WHERE vbeln = it_likp-vbeln AND
    wbstk = 'C' AND
    vbtyp IN gr_delivery AND
    ( ( fkstk = 'A' OR fkstk = 'B' ) OR      <-- check this condition , if ( ) is needed ...
      ( fkivk = 'A' OR fkivk = 'B' ) ) .
    Regards,
    Srini.

  • Issue with select query for secondary index

    Hi all,
    I have created a secondary index A on mara table with fields Mandt and Packaging Material Type VHART.
    Now i am trying to write a report
    Tables : mara.
    data : begin of itab occurs 0.
    include structure mara.
    data  : end of itab.
    *select * from mara into table itab*
    CLIENT SPECIFIED where
      MANDT = SY-MANDT and
      VHART = 'WER'.
    I'm getting an error
    Unable to interpret "CLIENT". Possible causes of error: Incorrect spelling or comma error.          
    if i change to my select query     to
    *select * from mara into table itab*
      where
      MANDT = SY-MANDT and
      VHART = 'WER'.
    I'm getting an error
    Without the addition "CLIENT SPECIFIED", you cannot specify the client     field "MANDT" in the WHERE condition.
    Let me know if iam wrong and we are at 4.6c
    Thanks

    Like I already said, even if you have added the mandt field in the secondary index, there is no need the use it in the select statement.
    Let me elaborate on my reply before. If you have created a UNIQUE index, which I don't think you have, then you should include CLIENT in the index. A unique index for a client-dependent table must contain the client field.
    Additional info:
    The accessing speed does not depend on whether or not an index is defined as a unique index. A unique index is simply a means of defining that certain field combinations of data records in a table are unique.
    Even if you have defined a secondary index, this does not automatically mean, that this index is used. This also depends on the database optimizer. The optimizer will determine which index is best and use it. So before transporting this index, you should make sure that the index is used. How to check this, have a look at the link:
    [check if index is used|http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21eb3a446011d189700000e8322d00/content.htm]
    Edited by: Micky Oestreich on May 13, 2008 10:09 PM

Maybe you are looking for

  • My PC no longer recognises my HP lasaerjet 5100tn printer.

    Hi Windows 7 64-bit, HP laserjet 5100tn - parallel port to USB connection. I disconnected everything from my PC and hid it for security during  a recent holiday. When re-connecting I probably did not put things back in the same USB slots but everythi

  • ABAP routine help required in BI

    Hi Experts, I have a some fields in DSO (Data Store Object) as below _Code.................. Type.................... Date & Time_ 1..............................A....................01/01/10    01:00:00 1..............................B..............

  • DATABLOCK_EXECUTE_QUERY PROBLEM !

    hello guys, i have a problem in executing a query for a datablock. I have a datablock which i create with a from clause. The from clause contains the following sql code: SELECT mis_efhmeries.employee_id,mis_efhmeries.service, mis_efhmeries.sector, mi

  • ApplicationUpdater UI auto update failing Error# 16824

    We have an internal AIR app, there were some small changes made yesterday so the version number was increased and the application was packaged and uploaded to the server with an updated config XML on the server to match the new version number. Nothin

  • Gmail being Redirected in Safari

    Super odd...so I'm at the Detroit airport yesterday and I go to access my Gmail. There was no available WiFi network, I was still on EDGE, and a popup came up in Safari when I went to gmail.com. I didn't read it, foolishly, but it mentioned something