How to reverse where clause condition? please

Hello Good Morning,
i have below query which is working fine,
update t
set skipjet='Yes'
from  mytable t join mychildtable C on t.ssn=c.ssn
where
t.ChannelCd ='OB Calls' AND t.PlanBlance BETWEEN c.MinSalary  AND  c.MaxSalary
but my problem here is, i have to set skipjet='Y' when the above where clause not met (like opposite way)
Please advise?
Thank you in Advance
Asita

Dear Milano, 
I did an example and i got the result that you needed.
declare @mytable table (ssn int,ChannelCd varchar(50),PlanBlance money,skipjet varchar(3))
declare @mychildtable table (ssn int,MinSalary money,MaxSalary money)
insert into @mytable(ssn,ChannelCd,PlanBlance,skipjet) values (1,'OB Calls',800.00,'NO')
insert into @mytable(ssn,ChannelCd,PlanBlance,skipjet) values (1,'OB Calls2',800.00,'NO')
insert into @mychildtable(ssn,MinSalary,MaxSalary)values(1,600.00,800.00)
update t set skipjet='Yes'
from
@mytable t
where
not exists (
Select * from
@mychildtable C
where
t.ssn=c.ssn and
t.ChannelCd ='OB Calls' AND
t.PlanBlance BETWEEN c.MinSalary AND c.MaxSalary
Select * from @mytable
Result:
ssn         ChannelCd                                      PlanBlance           skipjet
1           OB Calls                                           800,00                NO
1           OB Calls2                                         800,00                Yes
(2 row(s) affected)
Ricardo Lacerda
Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

Similar Messages

  • In which order does the query's where clause condition is checked

    Hi All,
    can anyone tell me in which order does oracle evaluate the where clause condition?
    for ex: select * from users where user_type='Admin' and stauts='Enabled'

    user9981103 wrote:
    The conditions in the WHERE clause are checked in the reverse order of the given order.
    i.e; first it will check stauts='Enabled'* and then user_type='Admin'* for your given queryWhy do you believe that?
    If there is a sufficiently selective b-tree index on USER_TYPE, the optimizer would undoubtedly use that index to process the USER_TYPE = 'Admin' condition and then check the STATUS column.
    If there is a sufficiently selective b-tree index on STATUS, the optimizer would undoubtedly use that index to process the STATUS='Enabled' condition and then check the USER_TYPE column.
    If there is a composite b-tree index on (STATUS, USER_TYPE), the optimizer would use that index to process the two conditions nearly simultaneously, though technically the leading column of the index is evaluated first. Of course, if you reverse the order of columns in the index, you get a different evaluation order
    If there are bitmap indexes on STATUS and USER_TYPE, Oracle can combine the two indexes and evaluate the two conditions simultaneously.
    And that is leaving out tons of query plan options and other optimizer wrinkles.
    Justin

  • Sequence of tables in from clause and sequence of "where clause" conditions

    Is Sequence of tables in "From Clause" and sequence of "where clause" conditions matters in 10g for performance?
    Edited by: user6763079 on Jun 1, 2011 3:33 AM

    user6763079 wrote:
    Is Sequence of tables in "From Clause" and sequence of "where clause" conditions matters in 10g for performance?In general it does not matter.
    It could matter if the Rule Based Optimizer (RBO) is used. However this RBO is only used if enforced by a hint or if no table statistics are collected. Starting from 10g the table statistics are automatically selected by a regular database job. So in general the CBO would be used.
    The CBO will consider different access paths. If the number of tables is low enough, then all possible combinations are considered and the order does not make any difference.
    Edited by: Sven W. on Jun 1, 2011 4:00 PM

  • How to set Where clause in the View Object of the MessageChoice ?

    Hi,
    How to set Where clause in the View Object of the
    MessageChoice ?
    Example:
    <bc4j:rootAppModuleDef name="EdEscolaCampusView1AppModule"
    definition="ed00050.Ed00050Module"
    releaseMode="stateful" >
    <bc4j:viewObjectDef name="EdEscolaCampusView1" >
    <bc4j:rowDef name="CreateEdEscolaCampusView1" autoCreate="true" >
    <bc4j:propertyKey name="key" />
    </bc4j:rowDef>
    </bc4j:viewObjectDef>
    <bc4j:viewObjectDef name="ListaTipLocalView1"
    rangeSize="9999">
    </bc4j:viewObjectDef>
    </bc4j:rootAppModuleDef>
    </bc4j:registryDef>
    messageChoice declaration:
    <bc4j:messageChoice name="SeqTipoLocalCampus"
    attrName="SeqTipoLocalCampus"
    prompt="Local do Campus">
    <contents>
    <bc4j:optionList attrName="SeqTipoBasico"
    textAttrName="NomTipoBasico"
    voName="ListaTipLocalView1"/>
    </contents>
    </bc4j:messageChoice>
    I would like set where clause of ViewObject, with dinamic parameters (using attribute1 = :1), before populate messageChoice.
    thanks...
    Danilo

    Hi Andy,
    I try set a where clause using the message:
    Set where Clause parameter using UIX , but my UIX Page have 2 messageChoice's of different ViewObject's, then I need implement this Java Class:
    //Nome da Package da Tela Detail
    package br.com.siadem.siaed.ed00050;
    // Importa as Bibliotecas necessárias
    import oracle.jbo.ViewObject;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.client.Configuration;
    import oracle.cabo.servlet.BajaContext;
    import oracle.cabo.servlet.Page;
    import oracle.cabo.servlet.event.PageEvent;
    import oracle.cabo.servlet.event.EventResult;
    import oracle.cabo.data.jbo.servlet.bind.*;
    import oracle.cabo.ui.data.BoundValue;
    import oracle.cabo.ui.data.DataBoundValue;
    import javax.servlet.http.HttpServletRequest;
    import br.com.siadem.siaed.util.*;
    import javax.servlet.http.Cookie;
    import oracle.cabo.data.jbo.def.NestedAppModuleDef;
    import oracle.cabo.data.jbo.def.ViewObjectDef;
    import oracle.cabo.data.jbo.def.AppModuleDef;
    // Classe que configura os parametros para a execução da Query,
    // utilizando variáveis de Sessao
    public class FunPreQueryLista
    public static EventResult FunConfiguraQuery(BajaContext context, Page page, PageEvent event) throws Throwable
    // TrataDadosSessao - Classe utilizada para retornar os valores das variáveis de sessão genéricas
    // Ex: CodCliente, CodMunicipio etc...
    TrataDadosSessao varDadosSessao = new TrataDadosSessao();
    // 1o. Parametro Configurado - Através da classe TrataDadosSessao, utilizando um método Get
    // <alterar>
    String valor1 = varDadosSessao.getCodCliente();
    String valor2 = varDadosSessao.getCodMunicipio();
    //Cria o objeto que retorna o ApplicationModule
    ApplicationModule am = ServletBindingUtils.getApplicationModule(context);
    // Início das Configurações da Query da Lista
    //Cria o objeto que retorna o view object da lista desejada
    //alterar
    ViewObject TipoLocal = am.findViewObject("ListaTipoLocalView1");
    //Configuração dos parametros definidos na query do view Object
    //alterar
    TipoLocal.setWhereClauseParam(0,valor1);
    TipoLocal.setWhereClauseParam(1,valor2);
    // Executa a Query
    TipoLocal.executeQuery();
    // Fim das Configurações da Query da Lista
    // Início das Configurações da Query da Lista
    //Cria o objeto que retorna o view object da lista desejada
    //alterar
    ViewObject TipoDestLixo = am.findViewObject("ListaDestinoLixoView1");
    //Configuração dos parametros definidos na query do view Object
    //alterar
    TipoDestLixo.setWhereClauseParam(0,valor1);
    TipoDestLixo.setWhereClauseParam(1,valor2);
    // Executa a Query
    TipoDestLixo.executeQuery();
    // Fim das Configurações da Query da Lista
    // Retorna o Resultado para a Página
    return new EventResult(page);
    The code works very well...
    And, I'm sorry for my two repost's in UIX Forum about this in a few time.
    Thank very much...
    Danilo

  • Including additional where clause conditions to view criteria dynamically

    Hi,
    We have a set of view objects that serves as LOV for various other view objects. All such LOV view objects have three specific attributes, two date attributes namely EffectiveStartDate, EffectiveEndDate and a String attribute namely UserSwitch based on which the LOV list needs to be filtered.
    All the view objects are having one or more view criterias with specific where clause conditions.
    Apart from those view criteria conditions, invariantly, we need the following conditions also
    :bindEffDate between EffectiveStartDate and EffectiveEndDate and UserSwitch = :bindUserSwitch.
    We wish not to include the above condition in each and every view criteria of each and every view object (Since we have around 800 view objects and a minimum of 2 view criterias per view object). Instead, we created a dummy view object (BaseViewObject) with two bind variables :bindEffDate and :bindUserSwitch and all the LOV view objects were made to extend this BaseViewObject.
    Therefore, whenever a view object atribute is attached with LOV using the above said LOV View Objects, the bind variables of the baseViewObject as well as the view object specific bind variables are available in the view accessors tab of the view object wizard where we can supply values to those bind variables.
    Now, we need to construct the view criteria filter clause. To achieve this, we created a class, CustomCriteriaAdapter.java extending oracle.jbo.server.CriteriaAdapterImpl. In the getCriteriaClause() method, we included the follwoing code:
    public String getCriteriaClause(ViewCriteria pViewCriteria)
    ViewObject vo = pViewCriteria.getViewObject();
    String userSelectSwitch = (String) vo.ensureVariableManager().getVariableValue("bindUserSwitch");
    String effBgnDt = vo.getAttributeDef(vo.getAttributeIndexOf("EffectiveStartDate")).getName();
    String effEndDt = vo.getAttributeDef(vo.getAttributeIndexOf("EffectiveEndDate")).getName();
    String customCriteria = " ( :bindEffDate >= " + effBgnDt + " ) AND ( :bindEffDate <= " + effEndDt + " OR " + effEndDt + " IS NULL ) ";
    StringBuffer completeCriteria = new StringBuffer();
    String criteriaClause = super.getCriteriaClause(pViewCriteria);
    if (criteriaClause != null && !criteriaClause.isEmpty())
    completeCriteria.append(criteriaClause + " AND ");
    completeCriteria.append(customCriteria);
    if (userSelectSwitch != null && "Y".equals(userSelectSwitch))
    String userSelectSw = vo.getAttributeDef(vo.getAttributeIndexOf("UserSwitch")).getName();
    completeCriteria.append(" AND (" + userSelectSw + "='Y' ) ");
    return completeCriteria.toString();
    Issues:
    The LOV list is not filtering the records based on the constructed conditions. Instead it is listing either all of the records considering only the view criteria conditions applied at design time irrespective of the userswitch and effectivedate conditions or the list is empty.
    Here, my questions are,
    1. Am I in the correct approach? If not, guide me in a more proper approach to achieve the same requirement.
    2. If the way I am trying is correct, where things are going wrong and why the dynamic condition is not getting effected?
    Kindly help in sorting out the issue.
    Thanks in advance.

    Hi Jobinesh,
    Thanks for your response and yes, we have done exactly as what you have mentioned. As explained earlier, a baseViewObject along with its Impl class has been created and it will be extended by all the viewobjects meant for serving LOV. Therefore, the superClass for any such LOV viewObject is the baseViewObjectImpl class. In that baseViewObjectImpl(), we have over-rided the criteriaAdapter() method and returned an instance of our customCriteriaAdapter() class.
    Below is the code we are using in the baseViewObjectImpl():
    package model.base.vo;
    import oracle.jbo.CriteriaAdapter;
    import oracle.jbo.server.ViewObjectImpl;
    public class BaseViewObjectImpl
    extends ViewObjectImpl
    * This is the default constructor (do not remove).
    public BaseViewObjectImpl()
    * Over-rided method of ViewObjectImpl class of the framework.
    * Calls the customized criteria adapter so that the default where clauses are added to the view criteria.
    * @return CriteriaAdapter.
    @Override
    public CriteriaAdapter getCriteriaAdapter()
    return new CustomCriteriaAdapter();
    I'll create a sample in HR schema and share with you shortly.
    Thanks and regards.

  • OA Framework LOV – How to add where clause dynamically at runtime

    Hi All,
    Following is my page design:
    MainAM (This is root Application module) Package is: mycompany.oracle.apps.<product>.<project>.server
    MainPageVO (This is the View Object associated to Main AM)
    LovAM (This Application module is for LOVs) Package is: mycompany.oracle.apps.<product>.<project>.lov.server
    FileNameLovVO (This is the View Object is for "File Name" LOV. It is associated LovAM)
    I my main page is attached to the "Main AM". In the main page, I have a custom search region and in that there is a messageLovInput type of field based on "FileNameLovVO". The field name is File Name.
    Use Case:
    When a user opens the page, I determine user type. If the use is a clerk (not a superuser) then I need to restrict values in my File Name LOV by setting where clause dynamically.
    Issue1:
    ====
    In the main page controller when I do following, OA Framework is not able to access the "FileNameLovVo".
    1. Following code is from the main page's controller:
    String userId = 100;
    LovAMImpl lovAm = new LovAMImpl();
    Serializable[] lovParameters = {userId};
    Class[] lovParamTypes = { String.class };
    lovAm.invokeMethod("initLovQuery", lovParameters, lovParamTypes);
    2. In LovAMImpl class I have created following method:
    public void initLovQuery(String useId)
    FileNameLovVOImpl fileNameLovVo = getFileNameLovVO1(); // ******This returns NULL*******
    if (fileNameLovVo == null)
    MessageToken[] errTokens = { new MessageToken("OBJECT_NAME", "getFileNameLovVO1")};
    throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens);
    fileNameLovVo.initQuery(userId);
    In the above code "FileNameLovVOImpl fileNameLovVo = getFileNameLovVO1();" is returning NULL.
    Please let me know what am I missing here.
    I resolved above issue with following work around:
    1. Attached "FileNameLovVO" to "MainAM"
    2. Moved initLovQuery(String useId) method to "MainAMImpl" class.
    Is that the correct way? I would prefer NOT to attach "FileNameLovVO" to "MainAM". Any suggestions?
    Issue2:
    ====
    After using above work around I tried to set WHERE clause dynamically:
    FileNameLovVO is based on following SQL query:
    SELECT DISTINCT file_name FROM <table> WHERE USER_ID like :1
    I need to pass value for USER_ID if the user is a clerk and I need to pass '%' if the user is a supper user. I'm passing value in "LovVo.initQuery(userId)" method using following code:
    public void initQuery(String userId)
    StringBuffer whereClause = new StringBuffer(1000);
    Vector parameters = new Vector(1);
    int bindCount = 0;
    setWhereClauseParams(null);
    if ((userId != null) && (!("".equals(userId.trim()))))
    parameters.addElement(servicerId);
    whereClause.append(++bindCount);
    if (bindCount > 0)
    Object[] params = new Object[bindCount];
    parameters.copyInto(params);
    setWhereClauseParams(params);
    executeQuery();
    When I select LOV at runtime in the page, it fails with following error:
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT DISTINCT file_name FROM <table> WHERE user_id LIKE :1) QRSLT WHERE (( UPPER(FILE_NAME) like :1 AND (FILE_NAME like :2 OR FILE_NAME like :3 OR FILE_NAME like :4 OR FILE_NAME like :5))) ORDER BY file_name desc
    OA Framework tries to create following statement:
    SELECT *
    FROM (SELECT DISTINCT file_name
    FROM <table>
    WHERE user_id LIKE :1) qrslt
    WHERE (( UPPER (file_name) LIKE :1
    AND ( file_name LIKE :2
    OR file_name LIKE :3
    OR file_name LIKE :4
    OR file_name LIKE :5
    ORDER BY file_name DESC
    Any help is greatly appreciated.
    Thanks for your help guys.
    Mitesh

    I have a lovinput item which has an external LOV attached to it - the VO uses the below sql query. I want to display the addresses of the customer accounts belonging to the customer name or account entered. I have a PPR event in the account number field which is calling the onAccountNumber method in my AM - the method is getting triggered when you enter the account number and the vo returns the rowcount as 3 exactly but if you click the lovinput item - it brings back all the addresses available instead bringing back addresses beloning to the account number.
    public void OnAccountNumber(String accountNumber,String partyName,
    Boolean executeQuery)
    System.out.println("Im here on account number" + accountNumber + " PartyName:" + partyName);
    AddressVOImpl Addrvo= getAddressVO1();
    Vector parameters = new Vector(2);
    StringBuffer whereClause = new StringBuffer(100);
    int clauseCount = 0;
    int bindCount = 0;
    Addrvo.setWhereClauseParams(null); // Always reset
    if ((accountNumber != null) && (!("".equals(accountNumber.trim()))))
    whereClause.append(" Account_Number = :");
    whereClause.append(++bindCount);
    parameters.addElement(accountNumber);
    clauseCount++;
    if ((partyName != null) && (!("".equals(partyName.trim()))))
    if (clauseCount >0){
    whereClause.append(" AND ");
    whereClause.append(" Party_Name like :");
    whereClause.append(++bindCount);
    parameters.addElement(partyName);
    clauseCount++;
    Addrvo.setWhereClause(whereClause.toString());
    if (bindCount >0)
    Object[] params=new Object[bindCount];
    parameters.copyInto(params);
    Addrvo.setWhereClauseParams(params);
    System.out.println("AddressVO:" + Addrvo.getQuery() );
    //Addrvo.executeQuery();
    System.out.println("Addr Cnt:" + Addrvo.getRowCount());
    SQL used in VO
    =========
    SELECT hl.address1
    || ' '
    || hl.address2
    || ' '
    || hl.address3
    || ' '
    || hl.city
    || ' '
    || hl.postal_code
    || ' '
    || hl.state
    || ' '
    || hl.country address,
    hca.account_number,hp.party_name
    FROM hz_cust_accounts hca,
    hz_cust_site_uses_all hcsu,
    hz_cust_acct_sites_all hcs,
    hz_party_sites hps,
    hz_locations hl,
    hz_parties hp
    WHERE hcsu.cust_acct_site_id = hcs.cust_acct_site_id
    AND hcs.party_site_id = hps.party_site_id
    AND hps.location_id = hl.location_id
    AND hca.cust_account_id = hcs.cust_account_id
    AND hcsu.site_use_code = 'SHIP_TO'
    AND hcsu.status = 'A'
    AND hp.party_id = hps.party_id
    AND hp.party_id = hca.party_id
    -- AND account_number=6028
    Can someone please tell me how to restrict the addresses lov to an entered account number or customer name??

  • How to use where clause with get statement in LDB programs

    Hi All,
    I am using logical databse in my report program.I am not getting how to use the where clause in the get statement is it possible to use?or if not possible only option is we should filter it after get statment is right?Can you please some body throw some idea on this?
    Regards
    Mahesh

    Hi,
    Reffer these links
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    reward if helpful
    Thanks,
    Suma.

  • Where clause condition

    How many conditions can will be applied in where clause and what is the maximum length for where condition?

    eda58bb6-6d5c-460a-9684-4302e17fa5c7 wrote:
    Thanks someoneElse for swift response. In this link it is not their.. WHERE CLAUSE Maximum length and maximum conditions.
    unwilling or incapable to use GOOGLE yourself?
    Ask Tom &amp;quot;maximum length of sql statement&amp;quot;
    BTW - there is no separate & distinct limit for the WHERE clause
    unless you what to consider below
    Subqueries
    Maximum levels of subqueries in a SQL statement
    Unlimited in the FROM clause of the top-level query255 subqueries in the WHERE clause"

  • Need Help on where clause condition

    Hello All,
    Thanks in advance::
    I have below SQL query which is returning 1500 records when i dont use any condition in where clause(Please see the query below);
    SELECT POS_TYPE,
    POS_ID,
    SUB_ACNT_ID,
    CHRG,
    DOC,
    NULL,
    ACNT_RLN,
    ACCOUNT_FLODERS_VER,
    DM_LSTUPDDT,
    DM_BTNUMBER,
    DM_USERID,
    DM_WSID,
    STAT_FLG,
    SERVICES_FLG,
    SERVICES,
    INTRST_COND,
    PST_INSTRN
    FROM &&SRC.ACCOUNT_FOLDERS,
    &&SRC.DB;
    Output: 15 rows retured
    And when i validate the data by putting some conditions in where clause , it is giving 1499 records ( Please see the query below with condition )
    SELECT POS_TYPE,
    POS_ID,
    SUB_ACNT_ID,
    CHRG,
    DOC,
    NULL,
    ACNT_RLN,
    ACCOUNT_FLODERS_VER,
    DM_LSTUPDDT,
    DM_BTNUMBER,
    DM_USERID,
    DM_WSID,
    STAT_FLG,
    SERVICES_FLG,
    SERVICES,
    INTRST_COND,
    PST_INSTRN
    FROM &&SRC.ACCOUNT_FOLDERS,
    &&SRC.DB
    WHERE (POS_TYPE,
    POS_ID,
    SUB_ACNT_ID) IN (SELECT POS_TYPE,
    POS_ID,
    SUB_ACNT_ID FROM ACCOUNT
    WHERE DM_LSTUPDDT > 1_LAST_RUN_DATE OR 1_FIRST_RUN_FLAG=1);
    Now, I wanted to know that missing record(1st SQL is giving 1500 rows without any condition & 1nd SQL is giving 1499 rows with condition in where clause)
    I am worried and confused to find out the missing record. Tried with different conditions like Not In... nothing worked perfectly.
    Could some one please have a look and provide me the correct SQL , Performance wise also it should be good, SQL should not cause any performance issues.
    Please help me on it..
    Thanks,
    MKR

    Do a minus
    SELECT POS_TYPE,
           POS_ID,
           SUB_ACNT_ID,
           CHRG,
           DOC,
           NULL,
           ACNT_RLN,
           ACCOUNT_FLODERS_VER,
           DM_LSTUPDDT,
           DM_BTNUMBER,
           DM_USERID,
           DM_WSID,
           STAT_FLG,
           SERVICES_FLG,
           SERVICES,
           INTRST_COND,
           PST_INSTRN
      FROM &&SRC.ACCOUNT_FOLDERS, &&SRC.DB;
    MINUS
    SELECT POS_TYPE,
           POS_ID,
           SUB_ACNT_ID,
           CHRG,
           DOC,
           NULL,
           ACNT_RLN,
           ACCOUNT_FLODERS_VER,
           DM_LSTUPDDT,
           DM_BTNUMBER,
           DM_USERID,
           DM_WSID,
           STAT_FLG,
           SERVICES_FLG,
           SERVICES,
           INTRST_COND,
           PST_INSTRN
      FROM &&SRC.ACCOUNT_FOLDERS, &&SRC.DB
    WHERE (POS_TYPE, POS_ID, SUB_ACNT_ID) IN (SELECT POS_TYPE, POS_ID, SUB_ACNT_ID
                                                 FROM ACCOUNT
                                                WHERE DM_LSTUPDDT > 1_LAST_RUN_DATE
                                                   OR  1_FIRST_RUN_FLAG = 1);  G.

  • How to use "where" clause in modify statement

    Hi
    can any1 telll me is it possible to use a where clause in a modify statemetn. I want to use modify statemetn  to insert a new recoed in a database table.
    Regards
    Sabahuddin Ahmed

    MODIFY itab - itab_lines
    Syntax :
    ... itab FROM wa TRANSPORTING comp1 comp2 ... WHERE log_exp.
    With these additions the MODIFY statement assigns the content of the comp1 comp2 ... components of the wa work area specified after TRANSPORTING to all lines in the itab table that meet the logical condition log_exp. The wa work area must be compatible with the line type of the internal table.
    The TRANSPORTING addition has the same effect as changing individual lines. The WHERE addition can only be specified together with the TRANSPORTING addition. After WHERE, any logical expression can be specified in which the first operand of each individual comparison is a component of the internal table. All logical expressions are therefore possible, with the exception of IS ASSIGNED, , and IS SUPPLIED. It is not possible to dynamically specify a component using bracketed character-type data objects.
    While for standard tables and hashed tables all lines in the internal table are checked for the logical expression of the WHERE statement, for sorted tables, optimized access can be achieved by checking at least one opening part of the table key for parity using AND linked queries in the logical expression.
    Example
    Change the contents of the planetype component for all lines in the sflight_tab internal table in which this component contains the value p_plane1 to the value p_plane2.
    PARAMETERS: p_carrid TYPE sflight-carrid,
                p_connid TYPE sflight-connid,
                p_plane1 TYPE sflight-planetype,
                p_plane2 TYPE sflight-planetype.
    DATA sflight_tab TYPE SORTED TABLE OF sflight
                     WITH UNIQUE KEY carrid connid fldate.
    DATA sflight_wa TYPE sflight.
    SELECT *
           FROM sflight
           INTO TABLE sflight_tab
           WHERE carrid = p_carrid AND
                 connid = p_connid.
    sflight_wa-planetype = p_plane2.
    MODIFY sflight_tab FROM sflight_wa
           TRANSPORTING planetype WHERE planetype = p_plane1.
    reward if useful

  • How to use WHERE Clause in BPEL

    Hi ,
    i am trying to use where clause in DB adapter but its not working.
    my query is "select empname from employee where empid = &a"
    can any body tell me what is the reason its npt working?
    and how can i retrive data form DB?

    Hi,
    You are thinking perfectly fine. The solution what I suggested was
    select ename from emp where empno=?
    And the solution provided by you was
    SELECT first_name, last_name FROM per_all_people_f WHERE person_id = #p_person_id
    There is no problem with the above mentioned select statements.
    I just want to say that if you see closely, internal logic changes #parameter name to ?. So both the logics are right.
    Cheers,
    Abhi...

  • How to change where clause in VO query in bean

    Hi experts
    I have to modify vo object query where clause on run time .. is it possible??
    if yes please suggest me,

    as mentioned by Timo, it is very much possible
    see this following link -
    Changing the WHERE clause or VO Query at runtime in Oracle ADF | Techartifact
    Dynamically changing query in view object in Oracle ADF | Techartifact

  • How to canel where clause equal effect

    hi all
    in JPAQL
    i wanna cancel the where clause effect in order to use the following example query
    select u from user u where u.name= :name
    the question is what to put for the value of the parameter:name to make the query get all the objects ,ie. make it match against any name,i know that this can be achieved with omiting the where clause alltogether but my real world query is much complex and i cannot guarentee that each time i run the query all the parameters will be assigned so i want to neutralize the effect of effect of the unassigned parameters by making a default that get all objects, i cannot use dynamically generated sql or jpaql as my db perform much much better with precompiled queries
    please help me and tell me if ur solution is portable among JPA providers(in the spec )or just available in KODO
    thanx alot

    hi all
    in JPAQL
    i wanna cancel the where clause effect in order to use the following example query
    select u from user u where u.name= :name
    the question is what to put for the value of the parameter:name to make the query get all the objects ,ie. make it match against any name,i know that this can be achieved with omiting the where clause alltogether but my real world query is much complex and i cannot guarentee that each time i run the query all the parameters will be assigned so i want to neutralize the effect of effect of the unassigned parameters by making a default that get all objects, i cannot use dynamically generated sql or jpaql as my db perform much much better with precompiled queries
    please help me and tell me if ur solution is portable among JPA providers(in the spec )or just available in KODO
    thanx alot

  • How to write WHERE clause in dynamic record group in oracle forms

    hi this is s.v.eswar,PLZ HELP ME
    i am new to oracle forms
    i want to write where clause in dynamic recordgroup
    this is the code i have written
    DECLARE
         MGR_ITEM ITEM:=FIND_ITEM('MGR');
         RG_ID_MGR RECORDGROUP:=NULL;
         MGR_DUMMY NUMBER;
    BEGIN
         RG_ID_MGR:=FIND_GROUP('MGRNUMBER');
         IF ID_NULL(RG_ID_MGR) THEN
              RG_ID_MGR:=CREATE_GROUP_FROM_QUERY('MGRNUMBER','SELECT DISTINCT TO_CHAR(EMPNO),TO_CHAR(EMPNO) FROM EMP WHERE JOB='MANAGER''); --THIS IS THE LINE I AM GETTING ERROR
         END IF;
         IF NOT ID_NULL(RG_ID_MGR) THEN
              MGR_DUMMY:=POPULATE_GROUP('MGRNUMBER');
              IF MGR_DUMMY=0 THEN
                   POPULATE_LIST(MGR_ITEM,'MGRNUMBER');
              END IF;          
         END IF;     
    END;
    COMPILE TIME ERROR
    1)I have written where clause like this WHERE JOB='MANAGER'
    then oracle compiler has given error like
    ENCOUNTERED THE SYMBOL 'MANAGER' WHEN EXPECTING ONE OF THE FOLLOWING .,().........etc
    (FOR THE ABOVE ERROR I JUST REMOVED SINGLE CODES AND WRITE LIKE THIS ----->WHERE JOB=MANAHER)------>THEN COMPILED SUCESSFULLY)
    AND I RUN THE FORM
    RUN TIME ERROR
    FRM-41072: CAN NOT CREATE GROUP 'MGRNUMBER'

    Hi there
    pls have a look here
    Dependent drop down lists in forms 6i
    hope this helps...
    regards,
    Amatu Allah

  • How to build where clause in this query

    Hi all,
    Version Details
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE     11.2.0.2.0     Production
    TNS for Solaris: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    Status_cid  filter in the following query should be 3,86,25 for org_unit_sid 3001 and for other organizations it should be 5,86 .
    Please let me know how this can be done .
    SELECT *
      FROM table_name pr
    WHERE pr.status_cid IN              /*pr.status_cid is number (2) data type * /
              ((CASE
                   WHEN pr.org_unit_sid = 3001
                      THEN (SELECT '5,86,25'   -- this is not working
                              FROM DUAL)
                   ELSE (SELECT '5,25'
                           FROM DUAL)
                END
    I know this can be done using union  as follows ..
    SELECT *
      FROM ((SELECT *
               FROM temp pr
              WHERE pr.org_uni_sid = 3001 AND pr.status_cid IN (5, 86, 25))
            UNION
            (SELECT *
               FROM temp pr
              WHERE pr.org_uni_sid <> 3001 AND pr.status_cid IN (5, 86)))
    Any help in this regard  is appreciated .............Thanks,
    P Prakash

    SELECT *
    FROM   table_name pr
    WHERE ( (pr.status_cid IN (5,86) OR ( pr.org_unit_sid = 3001 AND pr.status_cid IN (25))
    {code}
    PS: Kindly mark the answers to your post as helpfull/correct if you are satisfied
    Edited by: Himanshu Binjola on Apr 23, 2012 9:34 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • ORA-06564: object "ED"."BIN$eEXhW2fZlgDgQAoKUVFSiw==$0" does not exist

    Oracle 11.0.1.7: When I run streams remove procedure I keep getting the following: ERROR at line 1: ORA-06564: object "ED"."BIN$eEXhW2fZlgDgQAoKUVFSiw==$0" does not exist ORA-06512: at "SYS.DBMS_LOGREP_UTIL", line 82 ORA-06512: at "SYS.DBMS_LOGREP_UT

  • Methods to do increasing in java coding

    may i know how to do a selective code to do increasing in java code? like : i got numbers 20, 30, 20 ,20 IT IS BEFORE I ENTERED ANY NUMBERS IN !! uniqueNumber 0 numberOfuniqueNumbers 0 occurrences 0 IF i enter 20 into the system THEN uniqueNumber wil

  • Connecting to 1440 x 900 TV

    I bought a 2012 Mini a month ago.  I needed my monitor to read various account settings from my old mini, so I used an HDMI cable to connect the new Mini to a 1440 x 900 TV. Reading information from the TV screen was a hassle because black text came

  • Username and password in page0

    i have developed an application where in which i have to register new users with their own username and password. i want to write the code without using the default login page where in which there are stored packages and procedures, can any body just

  • ERORR IN  FTP_CONNECT

    Hi, i am trying to use FTP_CONNECT to establisht he connection but its giving error Attempt to set up connection to failed. i am passing the scrambled paswd . Could you plz tell me what is the issue.. step followed. 1. p_user = 'ABCD'. l_pwd = 'mx123