How to make select statement wait

how can i make the select statement wait until there is not lock on the table( or a row) and return the row once the lock is released is there is a lock on it
example
i have a Table t1 with columns c1 and c2
process1
stmt1 as select c1 from t1 where c1=1
process2
select c1 from t1 where c1=1
/*some operations */
update t1 set c2=4 where c1=1
when process1 is executed it has to wait for process 2 to complete the return a row since it has to be synchronised and are run from different location
thanks in advance

You want to get around session consistent select. This is such a nice feature actually. But if you really want to do it, you can fool process 1 by telling it you want to do an update.
This is process 2:
SQL> update emp set sal=900 where empno=7369;
1 row updated.Note I do not commit yet.
This is process 1, with a "select for update".
SQL> select sal from emp where  empno=7369 for update wait 10;
select sal from emp where  empno=7369 for update wait 10
ERROR at line 1:
ORA-30006: resource busy; acquire with WAIT timeout expired"wait 10" tells Oracle to wait 10 seconds to get a lock.
Now process 2 commits within the 10 seconds. The result of process 1 is then:
SQL> select sal from emp where  empno=7369 for update wait 10;
       SAL
       900
SQL> commit;You have to issue a commit or rollback in process 1 immediately to release the lock that process 1 laid on the record.

Similar Messages

  • How to write select statement in XSL-FO type XML program

    Hi All,
    Could you please anyone explain briefly how to write select statement in XSL-FO XML Program.
    Requirement:
    In the seeded program, OAF page is creating one XML file and through XSL-FO type XML Pulisher loading data and generating PDF output. as per the requirement some of the informations are missing in the XML file and for modifing the OAF page will be taking someting. we are planing to write a select query inside the XSL-FO program to get the required information.
    Could you please help me how to write a select statement inside the XSL-FO type programs.
    Please give me some example program for this...
    Thanks in Advance.
    Regards,
    Senthil

    Hi ,
    Please check the below code and modified plant as select-option
    Check the below code :
    tables : mara,
    mast.
    data : begin of i_data occurs 0,
    matnr like mara-matnr,
    end of i_data.
    select-options : s_matnr for mara-matnr,
                           <b>S_werks for mast-werks.</b>
    start-of-selection.
    select a~matnr into table i_data
    from mara as a inner join mast as b on amatnr = bmatnr
    where <b>b~werks in s_werks</b>
    and a~matnr in s_matnr
    and a~mtart = 'AA'
    or a~mtart = 'UT'
    and b~stlan = '1'.
    loop at i_data.
    write:/ i_data-matnr.
    endloop.
    Hope you got it.
    Thanks
    Seshu

  • How to write Select statement for this codition

    I need to check whether SGTXT contains BELNR value.
    SGTXT is a text field and It should be matched with BELNR
    How to write select statement for this.
    Select AUGBL AUGDT into t_BSAD
    from BSAD
    where SGTXT should have the given BELNR Value.
    Plz note : Here I cannot give as SGTXT = BELNR as coz BELNR have only 10 digits.

    Hi,
    data temp(12).
    concatenate '%' belnr '%' into temp.
    Select AUGBL AUGDT into t_BSAD
    from BSAD
    where SGTXT like temp.
    If belnr is having multiple values,just create a internal table as follows.
    types : begin of ty,
            belnr....
            temp(12),
            end of ty.
    data itab_ type standard table of ty.
    data wa type ty.
    loop at itab into wa.
    concatenate '%' wa-belnr '%' into wa-temp.
    modify itab from wa index sy-tabix transporting temp.
    endloop.
    Change your select statement accordingly.
    Kindly reward poits if it helps.

  • How to write SELECT statement using tables ekko,ekpo and eket?

    Hi,
    I got a problem in  performance tuning using below tables?
    how to write SELECT statement using tables EKKO,EKPO and EKET and in conditon ( WHERE clause)  use only fields 
                        ekko~ebeln       IN ebeln
                       ekko~loekz       EQ ' '
                       ekko~lifnr       IN lifnr
                       ekko~ekorg       IN ekorg
                      ekko~ekgrp       IN ekgrp          
                       ekpo~werks       IN werks
                       ekpo~pstyp       EQ  '3'
                       ekpo~loekz       EQ  space
                       ekpo~elikz       EQ  space
                       ekpo~menge       NE  0
                     eket~rsnum       NE space.
    Thanks in Advance.
    bye.

    Hi,
    ekko~ebeln IN ebeln
    ekko~loekz EQ ' '
    ekko~lifnr IN lifnr
    ekko~ekorg IN ekorg
    ekko~ekgrp IN ekgrp
    ekpo~werks IN werks
    ekpo~pstyp EQ '3'
    ekpo~loekz EQ space
    ekpo~elikz EQ space
    ekpo~menge NE 0          " Remove this from where clause
    eket~rsnum NE space.    " Remove this from where clause
    ' instead delete the entries after fetching into the table
    DELETE it_itab WHERE menge EQ '0' AND rsnum EQ ' '.
    Regards
    Bala Krishna

  • Make selection state to tableSelectMany

    hi everyone
    I have a problem and i would like to someone help me to solve this problem
    the problem is :
    I use adf 10 components in my jsf pages
    one of the pages has <af:table>.... etc
    and in this table there <f:facet name="selection"><af:tableSelectMany/></f:facet>
    everything is ok about readins the selected rows and .....etc
    but the problem is when I want to view this table with old selected rows
    I could not find way to build or make selection state
    in short I want way to view table with selected and unselected rows depends on my data
    thanks

    thanks for your replay
    the tableSelectMany put the id's of rows that selected in selectionState and exactly in keySet
    I tested to do this code when show the page
    TableBinding.setSelectionState(new RowKeySet());
    TableBinding().getSelectionState().getKeySet().add(new String("1"));
    and 1 is id of one of the rows but not selected
    can you help me by example please

  • "Check Statistics" in the Performance tab. How to see SELECT statement?

    Hi,
    In a previous mail on SDN, it was explained (see below) that the "Check Statistics" in the Performance tab, under Manage in the context of a cube, executes the SELECT stament below.
    Would you happen to know how to see the SELECT statements that the "Check Statistics" command executes as mentioned in the posting below?
    Thanks
    ====================================
    When you hit the Check Statistics tab, it isn't just the fact tables that are checked, but also all master data tables for all the InfoObjects (characteristics) that are in the cubes dimensions.
    Checking nbr of rows inserted, last analyzed dates, etc.
    SELECT
    T.TABLE_NAME, M.PARTITION_NAME, TO_CHAR (T.LAST_ANALYZED, 'YYYYMMDDHH24MISS'), T.NUM_ROWS,
    M.INSERTS, M.UPDATES, M.DELETES, M.TRUNCATED
    FROM
    USER_TABLES T LEFT OUTER JOIN USER_TAB_MODIFICATIONS M ON T.TABLE_NAME = M.TABLE_NAME
    WHERE
    T.TABLE_NAME = '/BI0/PWBS_ELEMT' AND M.PARTITION_NAME IS NULL
    When you Refresh the stats, all the tables that need stats refreshed, are refreshed again. SInce InfoCube queries access the various master data tables in quereis, it makes sense that SAP would check their status.
    In looking at some of the results in 7.0, I'm not sure that the 30 day check is being doen as it was in 3.5. This is one area SAP retooled quite a bit.
    Yellow only indicates that there could be a problem. You could have stale DB stats on a table, but if they don't cause the DB optimizer to choose a poor execution plan, then it has no impact.
    Good DB stats are vital to query performance and old stats could be responsible for poor performance. I'm just syaing that the Statistics check yellow light status is not a definitive indicator.
    If your DBA has BRCONNECT running daily, you really should not have to worry about stats collection on the BW side except in cases immediately after large loads /deletes, and the nightly BRCONNECT hasn't run.
    BRCONNECT should produce a lof every time it runs showing you all the tables that it determeined should have stats refreshed. That might be worth a review. It should be running daily. If it is not being run, then you need to look at running stats collection from the BW side, either in Process Chains or via InfoCube automatisms.
    Best bet is to use ST04 to get Explain Plans of a poor running InfoCube query and then it can be reviewed to see where the time is being spent and whether stats ate a culprit.

    Hi,
    Thanks, this is what I came up with:
    st05,
    check SQL Trace, Activate Trace
    Now, in Rsa1
    on Cube, Cube1,
    Manage, Performance tab, Check Statistics
    Again, back to st05
    Deactivate Trace
    then click on Displace Trace
    Now, in the trace display, after scanning through  the output,
    “ … how do I see the SELECT statements that the "Check Statistics" command executes …”
    I will appreciate your help.

  • How to make Select Options Mandatory?

    Hi Guys,
                  Can anybnody tell me how to Declare  Selection Options for some of them mandatory.
    Select-Options : v_PurOrg for EKKO-EKORG default '2000',
                             v_GRDate for Sy-Datum ,
                             v_GRPrd  for MSEG-GJAHR.
             In these i have to make v_PurOrg Manadatory.
    Thanks,
    Gopi.

    Hi Gopi,
    In order to make select-options mandatory we add OBLIGATORY in the statement like the below.
    Selection-Screen.
    Select-Options : v_PurOrg for EKKO-EKORG default '2000' OBLIGATORY.
    In this case, only the first option will have the default value of 2000.But if you want both the options low and high of select-options, means you have to add the below code in your program in the initialization event.
    Initialization.
    v_PurOrg-low    =   1000. 
    v_PurOrg-high    =   2000. 
    append v_PurOrg.
    Hope this helps.
    Please reward if useful.
    Thanks,
    Srinivasa

  • How to make select list as read only

    Hi All.
    when i m loading a page ...how to make value of select list as read only ..
    i tried doing this ....
    i added readonly attribute to the select list's element attibute ...it is showing as read only field by darkening the select list field but ... the select list is editable even now... its allowing to choose from drag and drop ...
    Thanks & Regard ,
    Nandini

    I have the same requirment..
    I have a select list on a editable form and i want to make that one read only.
    When I use read only property it doent do anything. (But this is working for text items well).
    When I use "disabled' option it works fine. But then that value does not post when use POST the form. So making select list disabled is not a solution.
    Any Idea..
    Thanks
    mc

  • How to write select statement directly in java file instead of using vo

    Hi,
    I have written the following code in my java file:
    if(empvo==null)
    empvo=worklistamimpl2.createViewObject("InvoiceVO", "xxetfc.oracle.apps.icx.icatalog.shopping.server.InvoiceVO");
    if(empvo!=null){
    OAViewObject oaviewobject2 = (OAViewObject)worklistamimpl2.findViewObject("InvoiceVO");
    OAViewObjectImpl oaviewobjectimpl = (OAViewObjectImpl)oapagecontext.getApplicationModule(oawebbean).findViewObject("InvoiceVO");
    oaviewobject2.setWhereClause("Invoice_num="+" ' " + s + " ' ");
    oaviewobjectimpl.executeQuery();
    String abc = (String)oaviewobjectimpl.first().getAttribute("Invoice_id");
    It is giving me error as
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (select invoice_id from ap_invoices_all) QRSLT WHERE (Invoice_num='ERS15022012_3')
    1. Why is this error coming.. how to solve this
    2. Instead of using vo how can i write select statement directly in the above code
    Thanks,
    Edited by: user10873676 on Apr 9, 2012 1:18 AM
    Edited by: user10873676 on Apr 9, 2012 1:21 AM

    it says java.sql.SQLSyntaxErrorException: ORA-00904: "INVOICE_NUM": invalid identifier
    where as invoice_num column is present in my table

  • How to write select statement ?

    Hi,
    i have requirement like below :
    In selection screen we have material number as selection options  and plant as single entry.
    Based on the input.
    We have to extract  the material number and plant based on MTART = AA or UT in MARA table and STLAN = 1 in MAST table.
    how to write a select statment to pick values from selection option and extract those material and plant which fullfill above conditions.
    Please let me know..
    its urgent
    please help..
    i have written code like below..
    types: begin of x_it_mat,
           matnr type mkal-matnr,
           werks type mkal-werks,
           stlan type mast-stlan,
           end of x_it_mat.
    types: begin of x_it_mat1,
           matnr type mkal-matnr,
           werks type mkal-werks,
           mtart type mara-mtart,
           end of x_it_mat1.
    data : it_mat type table of x_it_mat,
           wa_mat like line of it_mat.
    data : it_mat1 type table of x_it_mat1,
           wa_mat1 like line of it_mat1.
    TABLES: MKAL , MAST , MARA.
    SELECTION-SCREEN BEGIN OF BLOCK matnr
                              WITH FRAME TITLE TEXT-001.
    select-options :
      so_matnr for mkal-matnr.
    SELECTION-SCREEN END OF BLOCK matnr.
    SELECTION-SCREEN BEGIN OF BLOCK plant
                              WITH FRAME TITLE TEXT-002.
    parameter p_werks type mkal-werks.
    SELECTION-SCREEN END OF BLOCK plant.
    select matnr
           werks
           stlan
           from mkal INTO table it_mat
           where matnr in so_matnr
           and werks = p_werks.
    after this how to write another select statement to extract material by satisfiying above 2 conditions..

    Hi ,
    Please check the below code and modified plant as select-option
    Check the below code :
    tables : mara,
    mast.
    data : begin of i_data occurs 0,
    matnr like mara-matnr,
    end of i_data.
    select-options : s_matnr for mara-matnr,
                           <b>S_werks for mast-werks.</b>
    start-of-selection.
    select a~matnr into table i_data
    from mara as a inner join mast as b on amatnr = bmatnr
    where <b>b~werks in s_werks</b>
    and a~matnr in s_matnr
    and a~mtart = 'AA'
    or a~mtart = 'UT'
    and b~stlan = '1'.
    loop at i_data.
    write:/ i_data-matnr.
    endloop.
    Hope you got it.
    Thanks
    Seshu

  • How to make selection parameter gray out, not changeble mode

    Hi Experts,
      Selection screen having parameters, I am putting default values in that parametrs.
    How to make this parameter gray out, not changeable mode.
    Thanks in advance
    mahahe.
    See comments below
    Edited by: Rob Burbank on Jul 1, 2009 12:43 PM

    Hi,
    For the parameters required, while declaring them use the MODIF ID, lets say you have choosen the modif id as SC1.
    i.e. parametes: p_mat type matnr DEFAULT '100' MODIF ID SC1.
    Then in the initialization event, code as below.
        LOOP AT SCREEN.
          IF screen-group1 = 'SC1'.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
    It will work.
    Regards,
    Nangunoori.

  • How to make selected and active a child row of a treeTable?

    Hello,
    I am inserting a new child row into a af:treeTable, disclosing it, but I can't figure out how to make it selected and active so the focus of the user to go on it.
    Jdeveloper version 11.1.2.3.0
    This is how I am inserting the child node:
    public void createLocation(RowIterator ri, Key selectedNodeKey) {
            final String locationCategoryViewDef = "model.views.LocationCategoryView";
            if (ri != null && selectedNodeKey != null) {
                Row[] found = ri.findByKey(selectedNodeKey, 1);
                if (found != null && found.length == 1) {
                    Row foundRow = found[0];
                    String nodeDefname = foundRow.getStructureDef().getDefFullName();
                    RowSet parents = (RowSet)foundRow.getAttribute("LocationView");
                    Row childrow = parents.createRow();
                    //hardcoded locationId
                    childrow.setAttribute("LocationId", 434558);
                    parents.insertRow(childrow);
    }  And this is the treeTable:
    <af:treeTable value="#{bindings.LocationCategoryView2.treeModel}" var="node" varStatus="vaarr"
                  partialTriggers="gaga gag4a ga4a"
                  selectionListener="#{bindings.LocationCategoryView2.treeModel.makeCurrent}"
                  displayRow="selected" rowSelection="single" id="tt1" editingMode="clickToEdit"
                  horizontalGridVisible="true" binding="#{pageFlowScope.treeTableBean.sampleTreeTable}">
        <f:facet name="nodeStamp">
            <af:column id="c5" width="15">
                <af:outputText value="#{node}" inlineStyle="display:none" id="ot1"/>
            </af:column>
        </f:facet>
        <f:facet name="pathStamp">
            <af:inputText value="#{node}" id="ot2"/>
        </f:facet>
        <af:column id="c2" headerText="Location CategoryName">
            <af:inputText value="#{node.LocationCategoryName}" inlineStyle="font-weight:900" id="ot45"/>
        </af:column>
        <af:column id="c6" headerText="Location CATID">
            <af:inputText value="#{node.LocationCategoryId}" inlineStyle="font-weight:900" id="ot6"/>
        </af:column>
        <af:column id="cgg2" headerText="Var INDEx">
            <af:outputText value="#{vaarr.index}"/>
        </af:column>
        <af:column id="c1" headerText="Location Name">
            <af:inputText value="#{node.LocationName}" id="ot3"/>
        </af:column>
        <af:column>
            <af:panelGroupLayout layout="vertical">
                <af:commandLink id="gaga" text="addLocation" inlineStyle="color:red"
                                action="#{pageFlowScope.treeTableBean.createChildren}"
                                rendered="#{node.LocationId == null}" partialSubmit="true"/>
                <af:commandLink id="gag4a" text="delete category" inlineStyle="color:blue"
                                partialSubmit="true" rendered="#{node.LocationId == null}"
                                action="#{pageFlowScope.treeTableBean.deleteChildRow}"/>
                <af:commandLink id="ga4a" text="delete location" inlineStyle="color:green"
                                partialSubmit="true" rendered="#{node.LocationId != null}"
                                action="#{pageFlowScope.treeTableBean.deleteChildRow}"/>
            </af:panelGroupLayout>
        </af:column>
    </af:treeTable>

    Yes I did now but nothing changes. The current, selected and active row is still the parent node...
    Even I am adding AdfFacesContext.getCurrentInstance().addPartialTarget(this.sampleTreeTable); for just in case..

  • How to use SELECT statement  to extract KNA1-NAME1 and KNB1-ZSABE

    In building table I_KNA1 in  form f_extract_data, an additional select statement is needed to select and  append datafrom (KNA1 and KNB1) to existing I_KNA1
    In form f_extract_data table i_kna1 is populated with data from zd_kna101.(where ZD_KNA101 is a view of KNA1, KNB1 and KNBK.  It's a joint of these three tables.)  This will take care of all customers with KNBK-BANKL and KNBK-BANLN populated.  But this does not include new customers created in SAP CRM (no KNBK records).  Therefore a separate SELECT statement is needed to extract KNA1-NAME1 and KNB1-ZSABE for customers created in SAP CRM(the customers who do do not have BANKL and BANKN). These selected records are then need to be appended to I_KNA1.  It's possible that new selection statement might extract records that are already in existing I_KNA1 table.  IF this is the case, right after the append, sort I_KNA1 and remove duplicate records.
    form f_extract_data.
    select kunnr                         " Customer Number
             name1                         " Name
             zsabe                         " Business Unit
             bankl                         " Legacy Bank Key
             bankn                         " Legacy Bank Account
        from zd_kna101                     " View of KNA1, KNB1, and KNBK
        into table i_kna1
        for all entries in i_doc_by_ref
       where kunnr = i_doc_by_ref-kunnr
        and zsabe in s_zsabe.           
      if sy-subrc <> 0.
        message a116 with 'customer'.  " Customer Table is empty.  HALT!!!
      else.                                                    
        sort i_kna1 by kunnr.                                  
      endif.
    will I have to use the join statement(for KNA1-NAME1 and KNB1-ZSABE using the key as KUNNR) here or give two seperate select statements for extracting data from KNA1 and KNB1 using the key as KUNNR.
    THANKS FOR THE HELP.

    I would suggest using the join on KUNNR.  Maybe something like this.
    data: begin of itab occurs 0,
          kunnr type kna1-kunnr,
          name1 type kna1-name1,
          ZSABE type knb1-ZSABE,
          end of itab.
        select kna1~kunnr kna1~name1 knb1~zsabe
               into table itab
                    from kna1
                       inner join knb1
                            on kna1~kunnr = knb1~kunnr
                                   where ........
    Regards,
    Rich Heilman

  • How to write select statement before the loop and how to use read statemnt

    Hi,
    Recently our system has changed from 4.6 to ECC6.
    As its migrated its showing lots of errors like in between loop and endloop there should be no select statemnt........
    Can any one please tell how to write that coding in ECC6 , how can i change the code......
    In between loop and endloop i am having lots of select statemnts.....ple tell thye coding how can i select before the loop starts and
    how to read that internal table in loop.

    Hi Deepthi,
    You can do as per below:
    1) Select the required entries from the tables you need (VBAK, VBAP, KNA1, etc)
    SELECT VBELN ERDAT KUNNR
        into table it_vbak
        from VBAK
    where VBELN = S_VBELN. "Selection criteria
    If sy-subrc = 0.
    SELECT VBELN POSNR MATNR
        into table it_vbap
        from VBAP
    for all entries in it_vbak
    where VBELN = it_vbak-vbeln
    SELECT KUNNR NAME1
        into table it_vbak
        from VBAK
    where VBELN = it_vbak-vbeln.
    endif.
    2) Loop at the entries, and read internal table it-kna1 for customer info.
    Loop at it_vbak into wa_vbak.
    read table it_kna1 into wa_kna1 with key kunnr = wa_vbak-kunnr.
    if sy-subrc = 0.
    endif.
    loop at it_vbap into wa_vbap where vbeln = wa_vbak-vbeln.
    endloop.
    endloop.
    This is the basic idea and short example of how to extract entries and read internal table.
    Hope this helps.
    Regards,
    Patrick

  • Need help in how to combine select statement

    Hi,
    Table1 (VIEWREST2005)
    - ip
    - msg
    - fulldata
    - ID
    Table2 (L200505)
    - ip
    - msg
    - fulldata
    I want to create one sql that can select from table 2 to table number 1. This is my select statement, but it cannot running. The different between this 2 table is only column ID.
    insert into VIEWREST2005(ip,msg,fulldata) values(select ip, msg,fulldata from L200505)
    Can anyone modified my sql statement.

    Why do you not refer to the Oracle® Database SQL Reference manual? Or do you think your SQL Kung Fu is good enough that no RTFM'ing is needed?
    On-line copies of all Oracle documentation is available via http://tahiti.oracle.com/
    BTW, the correct syntax for this flavoured INSERT is:
    INSERT INTO table SELECT .. FROM table
    Drop the VALUES clause as no literal values are supplied.

Maybe you are looking for