PLS HELP ! WLS 6.1 CMP ejb query ORDERBY clause

Please Help,
How to do OrderBY clause ASC and DESC in weblogic 6.1 CMP?
Thanks

Hi Deepak,
First of all, thanks for answering.
Do you mean I should place that query within "weblogic-query" tag in the weblogic-cmp-rdbms-jar.xml?
I tried comment the query part in ejb-jar.xml with the ammended weblogic-cmp-rdbms-jar.xml.
The ejb compiler fail to compile the ejb because it cannot find the coresponse
Method.
Can you state a simple example this case with descriptors?, the descriptor make
me headache. Thanks
Deepak Vohra <[email protected]> wrote:
The WebLogic Query Language extension, ORDERBY, is a keyword that works
with the Finder method to allow you to specify which CMP file you want
to use for your selections.
The following example shows the use of the extension, ORDERBY.
SELECT A from A for Account.Bean
ORDERBY A.id ASC | DESC
ASC | DESC
Specify whether the ordering sequence is ascending or descending. ASC
is the default.
Ray wrote:
Please Help,
How to do OrderBY clause ASC and DESC in weblogic 6.1 CMP?
Thanks

Similar Messages

  • Pls. help me out..Accessing ejb through jsp

    hi all,
    I am running my ejb on the j2sdkee.1.2.1 and jdk1.3 on Windows 2000. I am facing a problem while accessing the ejb from the jsp page. Its running fine when accessing through a client application. The following is the error when I try to access it using:
    http://localhost:8000/first/FirstEJB.jsp
    Error: 500
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
         at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:287)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:137)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:148)
         at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:247)
         at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:352)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
         at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:626)
         at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:534)
         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)
         at org.apache.tomcat.core.Context.handleRequest(Context.java:644)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:440)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
         at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:310)
         at java.lang.Thread.run(Thread.java:484)
    Root cause:
    java.lang.NullPointerException
         at java.io.File.(File.java:181)
         at org.apache.jasper.compiler.JspCompiler.computeClassFileData(JspCompiler.java:285)
         at org.apache.jasper.compiler.JspCompiler.getClassName(JspCompiler.java:103)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:105)
         at org.apache.jasper.runtime.JspLoader$2.run(JspLoader.java:273)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:270)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:137)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:148)
         at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:247)
         at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:352)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
         at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:626)
         at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:534)
         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)
         at org.apache.tomcat.core.Context.handleRequest(Context.java:644)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:440)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
         at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:310)
         at java.lang.Thread.run(Thread.java:484)
    The name of the jsp file is FirstEJB.jsp
    The name of the ear file is FirstEJB - Stateless Session Bean
    The name of the WAR File is FirstWAR
    I have created a Web Component named first
    Can anyone tell me how to access the ejb using jsp?
    Thanks,
    ajit

    Hello all,
    Sorry for the trouble. I got the mistake..I had not given the context in the deploytool..
    Thanks,
    ajit

  • Help needed in building a  sql query

    Hello,
    I am using Oracle 10g db.
    I have 3 tables table1 and table2 and table3
    I am writing one sql query which is like
    select table1.a a1,(select distinct b from table2,table3 where table2.id=table3.id and table1.id=table2.id) b1
    from table1
    Now the b1 value may give more then 1 values so when i am trying to execute the query its giving me error.
    What i would like to have is if it gives returns more then 1 value then add that value as a new column means if b1 gives like abc and def as values.
    Then i want the sql to return like
    acolvalue abc def as a single row.
    Is this possible to do?
    Thanks

    Hello,
    The approach which i took is i wrote a function which gives me the b values , sseparated.
    Then i am building a outer query considering the max of b so i just found there are max 10 values which one row is showing.
    select b11,b12,b13,,,b10
    from (
    select table1.a a1,func(select distinct b from table2,table3 where table2.id=table3.id and table1.id=table2.id) b1
    from table1)
    but now i am facing problem like the value of b1 is a,b,c
    i want to use the substr and instr function to get
    a as b11
    b as b12
    c as b13
    can anyone pls help me out to write a query? i am getting b11 but other values are somehow not coming.
    for b11
    i used
    substr(b1,1,instr(b1,',',1,1)-1)
    Thanks

  • Pls Help! Failed to access local Session bean in 7.0!

    Hi all,
    Heard that to deploy local bean in weblogic 7.0, I need to put my war
    file and ejb jar files in the ear file. My client servlet contains the
    following:
    AccessControlLocalHome accessControlLocalHome =
    (AccessControlLocalHome)ctx.lookup("AccessControlLocalHome");
    But it failed miserably with the exception
    javax.naming.LinkException: . Root exception is
    javax.naming.NameNotFoundExcept
    ion: Unable to resolve
    'app/ejb/AccessControlBean.jar#AccessControlBean/local-ho
    me' Resolved: 'app/ejb'
    Unresolved:'AccessControlBean.jar#AccessControlBean' ; r
    emaining name 'AccessControlBean.jar#AccessControlBean/local-home'
    Just got an idea that it might be my web.xml file. So I include the
    following in my web.xml file:
    <ejb-local-ref>
         <ejb-ref-name>ejb/AccessControlLocalHome</ejb-ref-name>
         <ejb-ref-type>Session</ejb-ref-type>
    <local-home>com.spear.ejb.simorder.VendorOrderSLBean.AccessControlLocalHome</local-home>
    <local>com.spear.ejb.simorder.VendorOrderSLBean.AccessControlLocal</local>
    <ejb-link>AccessControlBean.jar#AccessControlBean</ejb-link>
    </ejb-local-ref>
    But it gives the following error:
    Module Name: projects, Error: weblogic.j2ee.DeploymentException: Could
    not setup
    environment - with nested exception:
    [javax.naming.NameNotFoundException: Unable to resolve ejb-link.
    AccessControlBe
    an.jar#AccessControlBean is not in the context. The context includes
    the followi
    ng link bindings: {} Make sure the link reference is relative to the
    URI of the
    referencing module.]
    Pls help!
    Thanks!
    Innovest

    <ejb-link> should be
    <ejb-link> ../AccessControlBean.jar#AccessControlBean</ejb-link>
    innovest wrote:
    Hi all,
    Heard that to deploy local bean in weblogic 7.0, I need to put my war
    file and ejb jar files in the ear file. My client servlet contains the
    following:
    AccessControlLocalHome accessControlLocalHome =
    (AccessControlLocalHome)ctx.lookup("AccessControlLocalHome");
    But it failed miserably with the exception
    javax.naming.LinkException: . Root exception is
    javax.naming.NameNotFoundExcept
    ion: Unable to resolve
    'app/ejb/AccessControlBean.jar#AccessControlBean/local-ho
    me' Resolved: 'app/ejb'
    Unresolved:'AccessControlBean.jar#AccessControlBean' ; r
    emaining name 'AccessControlBean.jar#AccessControlBean/local-home'
    Just got an idea that it might be my web.xml file. So I include the
    following in my web.xml file:
    <ejb-local-ref>
    <ejb-ref-name>ejb/AccessControlLocalHome</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>com.spear.ejb.simorder.VendorOrderSLBean.AccessControlLocalHome</local-home>
    <local>com.spear.ejb.simorder.VendorOrderSLBean.AccessControlLocal</local>
    <ejb-link>AccessControlBean.jar#AccessControlBean</ejb-link>
    </ejb-local-ref>
    But it gives the following error:
    Module Name: projects, Error: weblogic.j2ee.DeploymentException: Could
    not setup
    environment - with nested exception:
    [javax.naming.NameNotFoundException: Unable to resolve ejb-link.
    AccessControlBe
    an.jar#AccessControlBean is not in the context. The context includes
    the followi
    ng link bindings: {} Make sure the link reference is relative to the
    URI of the
    referencing module.]
    Pls help!
    Thanks!
    Innovest

  • SQL query...pls help ASAP

    Actor (Aname: varchar(40), Ano: varchar(6)) Ano is pk
    Movie (Mname: varchar(40),mno: varchar(8)) Mno is pk
    PlayIn (Ano, Mno, Pay: Integer) Ano and Mno are fk referencing Acotr and Movie respectively.
    Actor(Aname, Ano)
    A Bingo, A1
    B Castro, A2
    C Katie, A3
    S Hommy, A4
    J Tammy, A5
    K loren, A6
    Movie(Mname, Mno)
    Gladiator, M1
    Cast, M2
    Dog, M3
    Jilters, M4
    PlayIn(Ano,Mno,Pay)
    A1 M1 800
    A1 M2 1500
    A2 M2 78
    A2 M3 1750
    A2 M4 2301
    A3 M2 904
    A3 M3 629
    A4 M2 565
    A4 M3 5695
    A4 M4 1255
    A5 M1 989
    A5 M4 238
    A6 M2 137
    A6 M3 236
    A6 M4 545
    QUESTION: write SQL query to find the names of actors who earned less than 'B Castro' in each movie that 'B Castro' played in.

    thanks so so much.....
    another question:
    for each movie, list the movie number, the average
    pay and the total number of actors in the movie.....Rather than just asking homework questions and expecting everyone else to do your work for you, why don't you at least have a go at it yourself and post the query that you've tried, then we'll tell you where you are going wrong. You won't learn anything if we just write it for you.
    Also, your use of "pls help ASAP" in the subject title is not polite.
    This forum is manned by volunteers who have their own jobs and offer their help free of charge.
    Everyone who posts an issue on here would love to have it answered as soon as possible, but nobody has the right to assume that their issue is any more important, urgent or requires a quicker answer than anybody elses.
    If you need urgent help then you should pay someone to do the work for you.

  • Query on Time Scheduling ............................Urgent pls help

    Dear Friends
      Here is my query on Background processing,
      I want to run a program in background which ll save the details in AL11.
      I want to schedule this object between 12 AM night to 2 AM night as per the indian time standard.
      The data should be save the data in al11 as the following format=>
      1-It ll show the PO details that has been created between 12-1 and 1-2,it should not show 12-1 data in 1-2 means between 12 to 2 i ll store the data in AL11 that has been created between these one hour time if it would more than one hour than last one hour data it wont show in al11.
      Now the Pos that has been created between 2 am to next day night should be display when the user ll run the report at next day 12 o'clock.
    Can you give me the following idea,
    1-Which table stores the background scheduling time,if NAST than what is the field name.
    If anyone solve this kind of prob,pls help me on this.
    Thanks a lot
    mrutyun^

    Hi,
    Try table<b> TBTCS</b> which stores Background Processing: Time Schedule.
    Regards,
    Amit

  • Pls Help!! BMP EJB can select but not modify table

    Hi, please help!
    I wrote a CMP EJB for a simple table. Inside are JDBC calls to the database, using a connection object generated from the line:
    return new oracle.jdbc.driver.OracleDriver().defaultConnection();
    Or
    return DriverManager.getConnection("jdbc:oracle:kprb:");
    The EJB compiled and deployed without problem to OracleJVM, but using it with the test app, the bean can select, but no insert or update to the table!!!
    Then I found that, if I use the thin driver, as well as the username and password in the getConnection() call, I can insert and update without problem...
    I desperately need help for this problem, please enlighten me with any thought.
    Yours.
    Patrick.

    I have been suggested to use JNDI JDBC Datasource, but still no hope. Can someone on the JDev team helps?
    Very desperate.... =(
    Patrick.

  • EJB query language help!!

    Hi all, I have been trying to run a ejb query on JBoss 4.0.5, using built in hypersonic db, For some strange reasons am able to fetch all objects from db without any where clause but if am using a where clause with an attribute name from the entitybean am unable to retrieve any results.
    I get an org.hibernate.QueryException, could not resolve property : "property name"
    My ejb query looks like this...
    SELECT template FROM TemplateSelect template WHERE template.template_name='Template_One'
    TemplateSelect is my entity bean class and I do have an attribute named template_name in my bean class.
    could any one please suggest me what could be wrong and also direct me to a good tutorial on ejb query language as well as I am fairly new to hibernate and ejb3 !
    tons of thanks in advance!
    pravin

    Hi Anuradha ,
    I'm afraid the query language does not support retrieving the date portion (i.e. truncating the time) from a date field.
    I propose you turn you named into a BETWEEN query taking two parameters one for the beginning of the day and another for the end of the day. Then your named query could look like:
    SELECT max(o.req_id) FROM requests o WHERE o.requestdate BETWEEN :start AND :end
    The following code creates two calendar instances for the current day, one for 00:00:00 and another for 23:59:59:
    Calendar start = Calendar.getInstance();
    start.set(Calendar.HOUR_OF_DAY, 0);
    start.set(Calendar.MINUTE, 0);
    start.set(Calendar.SECOND, 0);
    start.set(Calendar.MILLISECOND, 0);
    Calendar end = Calendar.getInstance();
    end.set(Calendar.HOUR_OF_DAY, 23);
    end.set(Calendar.MINUTE, 59);
    end.set(Calendar.SECOND, 59);
    end.set(Calendar.MILLISECOND, 999);
    Here is some sample code that creates a query instance for a named query called findMaxRequestPerDay and passes the Date of the above Calendar instance as actual parameter values. It assumes the named query is called findMaxRequestPerDay and the req_id field is a long:
    Query query = em.createNamedQuery("findMaxRequestPerDay");
    query.setParameter("start", start.getTime());
    query.setParameter("end", end.getTime());
    Long max = (Long)query.getSingleResult();
    I hope this helps.
    Regards Michael

  • Consecutive Absent Days  Query.. Pls Help Gurus

    I have a table which stores attendance information
    For eg:
    Emp_No Date
    100 01-APR-2010
    102 05-APR-2010
    100 02-APR-2010
    I need a query with parameter From Date and To date..
    My Query Output should be like this .. considering that employee 100 is absent for 8 consecutive days and employee number 102 is absent for 2 consecutive days..
    It should return number of consecutive days he is absent.
    Empno Consecutive Days
    100 8 Days
    102 2 Days
    Pls Help Gurus.
    Edited by: suzvino on Jun 21, 2010 12:14 AM

    TUBBY_TUBBZ?with data as
      2  (
      3     select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      4     select 102 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      5     select 100 as emp_no, to_date('02-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      6     select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      7     select 100 as emp_no, to_date('03-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      8     select 100 as emp_no, to_date('04-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      9     select 100 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
    10     select 100 as emp_no, to_date('06-APR-2010','dd-mon-yyyy') as absent_date from dual union all
    11     select 100 as emp_no, to_date('07-APR-2010','dd-mon-yyyy') as absent_date from dual union all
    12     select 100 as emp_no, to_date('08-APR-2010','dd-mon-yyyy') as absent_date from dual union all
    13     select 100 as emp_no, to_date('09-APR-2010','dd-mon-yyyy') as absent_date from dual
    14  )
    15  select
    16     emp_no, max(level)
    17  from data
    18  connect by prior emp_no = emp_no and prior absent_date = absent_date - 1
    19  group by emp_no
    20  having max(level) >= 8;
                EMP_NO         MAX(LEVEL)
                   100                  9
    1 row selected.
    Elapsed: 00:00:00.01
    TUBBY_TUBBZ?Think i misread the post, so the query should be
    TUBBY_TUBBZ?with data as
      2  (
      3     select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      4     select 102 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      5     select 100 as emp_no, to_date('02-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      6     select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      7     select 100 as emp_no, to_date('03-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      8     select 100 as emp_no, to_date('04-APR-2010','dd-mon-yyyy') as absent_date from dual union all
      9     select 100 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
    10     select 100 as emp_no, to_date('06-APR-2010','dd-mon-yyyy') as absent_date from dual union all
    11     select 100 as emp_no, to_date('07-APR-2010','dd-mon-yyyy') as absent_date from dual union all
    12     select 100 as emp_no, to_date('08-APR-2010','dd-mon-yyyy') as absent_date from dual union all
    13     select 100 as emp_no, to_date('09-APR-2010','dd-mon-yyyy') as absent_date from dual
    14  )
    15  select
    16     emp_no, max(level)
    17  from data
    18  connect by prior emp_no = emp_no and prior absent_date = absent_date - 1
    19  group by emp_no;
                EMP_NO         MAX(LEVEL)
                   100                  9
                   102                  1
    2 rows selected.
    Elapsed: 00:00:00.01Edited by: Tubby on May 30, 2010 11:00 PM
    Added second query since i misread the post originally.

  • Complex query pls help

    I have a row output like this
    select * from test;
    s.no C1 C2 C3
    1 a1 b1 x1
    2 a1 b1 x2
    3 a1 b1 x3
    i want the output as with the new added column as like this
    s.no C1 C2 C3 C4
    1 a1 b1 x1 a1
    2 a1 b1 x2 b1
    3 a1 b1 x3 x3
    pls help me in this query its urgent for the solution

    Hello,
    So, what is the complexity in this query? Would you like to mention from where you will get that C4 column?
    -Ammad

  • Query-Automatic assignment of Record type to Book of Business-Pls help me

    I have a query about Automatic assignment of record in Book of Business.
    Using 5 record types & 50 regions as a part of Book of Business. You can say 50 sub-books.
    I want to assign these 5 record type to particular Book when to create & modify.
    Eg. When I create new account it should be automatically assigned to Book 1 & later I modify this account for reassignment to new user then it should be automatically added to the new user’s book.
    I need to create workflow for this as Assign to book criteria for both when new record saved & when modified record saved.
    I have tried this & its working; however problem is with the creation of two many workflows.
    50 region (Books) x 5 record types * 2 - Create/modify flow = 500 workflows for one country!
    If I am right then I can assign 1 record type with action as create or modify in 1 book only.
    How to reduce these no. of workflows?
    Pls help me out in this regard.
    Regards
    Mangesh

    Mangesh,
    I am sorry to tell you that there is no quick answer to this but i will say that maybe you need to rethink your book structure and their requirements here.
    I have 4 types and 7 regions so you need to create books to allocate all these on create and also modify. Customers have raised concerns with this to Oracle and they are looking into it but they are along way from completing this. Sorry to spoil your day but i would strongly ask you to consider your books structure before you complete this.
    Otherwise if you are using webservices you could assisgn the book when the record is piped into the CRM and then you only need to complete the modify workflows.

  • QUERY CLARIFICATION RQD :  gurus, experts pls help

    Hai,
    I am facing problem in performance of the query. sample scenario i have created here pls help me to solve
    **VEH_MAIN* TABLE (MASTER TABLE)*
    CREATE TABLE VEH_MAIN
       (     VIP_MOT_IND VARCHAR2(10 BYTE),
         VIP_IND NUMBER(10,0)
    Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',1);
    Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT02',5);
    Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('M0T03',1);
    Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',2);
    Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT02',6);
    Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',3);
    Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',4);
    **VEH_ENGINE_SUB* (table for engine subclass)*
      CREATE TABLE VEH_ENG_SUB
       (     ENG_SUBCLASS VARCHAR2(50 BYTE),
         ENG_MOT_IND VARCHAR2(10 BYTE)
    Insert into VEH_ENG_SUB (ENG_SUBCLASS,ENG_MOT_IND) values ('ENGSUB001','MOT01');
    Insert into VEH_ENG_SUB (ENG_SUBCLASS,ENG_MOT_IND) values ('ENGSUB001','MOT02');
    *VEH_ENG_IND( Detail table for engine subclass)*
      CREATE TABLE VEH_ENG_IND
       (     "ENG_SUBCLASS" VARCHAR2(50 BYTE),
         "ENG_IND" VARCHAR2(10 BYTE)
    Insert into VEH_ENG_IND (ENG_SUBCLASS,ENG_IND) values ('ENGSUB001','1');
    Insert into VEH_ENG_IND (ENG_SUBCLASS,ENG_IND) values ('ENGSUB001','2');
    *VEH_AXIS( Master table for Engine Axis)*
    CREATE TABLE VEH_AXIS
       (     ENG_AXIS VARCHAR2(50 BYTE),
         AXIS_MOT_IND VARCHAR2(10 BYTE)
    Insert into VEH_AXIS (ENG_AXIS,AXIS_MOT_IND) values ('ENGAXIS001','MOT01');
    Insert into VEH_AXIS (ENG_AXIS,AXIS_MOT_IND) values ('ENGAXIS002','MOT02');
    *VEH_AXIS_IND( Details table for engine axis)*
    CREATE TABLE VEH_AXIS_IND
       (     ENG_AXIS VARCHAR2(50 BYTE),
         ENG_IND VARCHAR2(10 BYTE)
    Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','1');
    Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','2');
    Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','3');
    Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','4');
    Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS002','5');
    Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS002','6');
    Condition 1
    if i select only ENGINE_SUBCLASS='ENGSUB001' then
    SELECT  vip_mot_ind,vip_ind
    FROM veh_main V,
    veh_eng_sub vsub,
    veh_eng_ind  vind
    WHERE (v.vip_mot_ind= vsub.eng_mot_ind
    and   v.vip_ind=vind.eng_ind
    and    vsub.eng_subclass= vind.eng_subclass
    AND vsub.eng_subclass='ENGSUB001' )output is
    MOT01     1
    MOT01     2
    Condition 2:if i select only the Engine Axis='ENGAXIS002' then the
    SELECT  vip_mot_ind,vip_ind
    FROM veh_main V,
    veh_axis  vaxis,
    veh_axis_ind vaind
    WHERE  v.vip_mot_ind= vaxis.axis_mot_ind
    and   v.vip_ind= vaind.eng_ind
    and   vaind.eng_axis= vaxis.eng_axis
    and   vaxis.eng_axis='ENGAXIS002';MOT02     5
    MOT02     6
    Condition 3:
    BOTH ENGINE AXIS AND ENGINE SUBCLASS
    SELECT  vip_mot_ind,vip_ind
    FROM veh_main V,
    veh_eng_sub vsub,
    veh_eng_ind  vind,
    veh_axis  vaxis,
    veh_axis_ind vaind
    WHERE (v.vip_mot_ind= vsub.eng_mot_ind
    and   v.vip_ind=vind.eng_ind
    and    vsub.eng_subclass= vind.eng_subclass
    AND vsub.eng_subclass='ENGSUB001' )
    AND  ( v.vip_mot_ind= vaxis.axis_mot_ind
    and   v.vip_ind= vaind.eng_ind
    and   vaind.eng_axis= vaxis.eng_axis
    and   vaxis.eng_axis='ENGAXIS002');Null values returned. this is correct.
    But the query PERFORMANCE fails in OR CONDITON as below
    Condition 4;
    SELECT  vip_mot_ind,vip_ind
    FROM veh_main V,
    veh_eng_sub vsub,
    veh_eng_ind  vind,
    veh_axis  vaxis,
    veh_axis_ind vaind
    WHERE (v.vip_mot_ind= vsub.eng_mot_ind
    and   v.vip_ind=vind.eng_ind
    and    vsub.eng_subclass= vind.eng_subclass
    AND vsub.eng_subclass='ENGSUB001' )
    OR  ( v.vip_mot_ind= vaxis.axis_mot_ind
    and   v.vip_ind= vaind.eng_ind
    and   vaind.eng_axis= vaxis.eng_axis
    and   vaxis.eng_axis='ENGAXIS002');output
    MOT02     5
    MOT02     5
    MOT02     5
    MOT02     5
    MOT02     6
    MOT02     6
    MOT02     6
    MOT02     6
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     1
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    MOT01     2
    This is sample example. when i implement in huge table with partition this scennario takes much time even 2 hours to run.
    i want the output must be as below if i use OR condition like condition 4
    MOT01     1
    MOT01     2
    MOT02     5
    MOT02     6
    Gurus and experts pls help me to solve this problem. Dont give any suggestion like
    SELECT  vip_mot_ind,vip_ind
    FROM veh_main V,
    veh_axis  vaxis,
    veh_axis_ind vaind
    WHERE  v.vip_mot_ind= vaxis.axis_mot_ind
    and   v.vip_ind= vaind.eng_ind
    and   vaind.eng_axis= vaxis.eng_axis
    and   vaxis.eng_axis='ENGAXIS002'
    union
    SELECT  vip_mot_ind,vip_ind
    FROM veh_main V,
    veh_eng_sub vsub,
    veh_eng_ind  vind
    WHERE (v.vip_mot_ind= vsub.eng_mot_ind
    and   v.vip_ind=vind.eng_ind
    and    vsub.eng_subclass= vind.eng_subclass
    AND vsub.eng_subclass='ENGSUB001' )
    }this will give correct result...
    MOT01     1
    MOT01     2
    MOT02     5
    MOT02     6
    but the problem is we cannot implement this in query. because query get framed at runtime there will be so many implement has to be done. other than UNION pls give me more suggesion
    waiting..
    S
    Edited by: A Beginner on Sep 11, 2010 12:51 AM

    create a view v1 with all the joins
    select * from v1 where eng_subclass='ENGSUB001'
    union
    select * from v1 where eng_axis='ENGAXIS002'
    If you really do not like the direct access with union, try this
    select * from v1
    where vsub_PK in (select vsub_PK from v1 where eng_subclass='ENGSUB001' )
    OR vsub_PK in (select vsub_PK from v1 where eng_axis='ENGAXIS002')
    --vsub_PK is the primary key of table vsub                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Cursor Query Pls help me

    Hi all,
    I m creating a table dynamically and after that i m inserting records in tht table dynamically..
    After tht i want to fetch all the records from tht table into a cursor which is a SYS_REFCURSOR. as i have to return the data to frntend ..
    But when i m opening tht cursor like
    OPEN cur_GetCertDetails
                   FOR
                   SELECT TRIM(certrefno) As CertNo,
                                  TRIM(damagedno) As Damagedno,
                                  TRIM(personname) As Name,
                                  TRIM(icnumber) As Icnumber,
                                  TRIM(coursename) As CourseName,
                                  TRIM(organiser) As Organiser,
                                  TRIM(location) As Location,
                             TRIM(TO_CHAR(startdate,'DD-MON-YYYY') ||' ~ '||
                                  TO_CHAR(enddate,'DD-MON-YYYY')) As StartEndDate
                             FROM ACprintInductionCert;
    Its giving error as
    64/5 PL/SQL: SQL Statement ignored
    73/10 PL/SQL: ORA-00942: table or view does not exist
    Dynamically created table name is ACprintInductionCert
    Pls help me out ..
    I have tried to use EXECUTE IMMEDIATE after FOR but its givin err

    since your table is created dynamically, you can not
    have the name hardcoded in the cursor....which is precisely the point (or one of them) I made in your Procedure Problem Urgent on this topic.
    Once you start down the road of dynamic code execution it is very difficult to stop. Dynamic code has its uses but it should be very much the last resort. Dynamic code means you are literally running untested code in a production environment, and is consequently more likely to fail. Its failures are also more difficult to recover from. It also makes dependency tracking extremely difficult.
    Cheers, APC

  • Select query. pls help

    Hi all
    i am new to abap
    I have the following requirement.
    kindly help me how to write the select queries to achieve it.
    its urgent
    pls help me
    thanks in advance
    In June of year 1, new budget prices must be determined for the following year (year 2). The budget prices for year 2 are calculated out of the average contract prices in the first 5 months of year 1 (January – May). The average contract price will then (outside the system) be corrected with an index. To calculate new prices for Campina Netherlands, a report is needed to show all materials with current budget price, volumes and contract prices during the first five months of year 1
    The purchasing assistant creates an excel file per Material type, based on the Budget pricelist out of SAP.
    Purchasers check the file on:
    &#61485;     being correct,
    &#61485;     materials marked for deletion in SAP
    &#61485;     changes to be made in data
    The new prices, calculated based ion the output of the SAP Budget pricelist, are sent to controlling in june year 1.
    On the 1st of January year 2 the new budget prices are inserted in SAP as the new standard price / budget price.
    the fields for display are as follows
    <b>table</b>               <b>  field<b>[/b</b>]             <b>   description</b>
    ekko                        ekorg                              pur org
    ekpo                        matnr                              mat no
    makt                        maktx                            mat des
    cawn                       zunspsc                         unspsc code
    mbew                      stprs                              standard price
    mbew                      peinh                               price unit
    mara                        meins                            base unit of measure
    s012                        menge                            purchsed amount of mat
                                                                         in month 1
    s012                       menge                            purchsed amount of mat
                                                                         in month 2
    s012                       menge                            purchsed amount of mat
                                                                         in month 3
    s012                       menge                            purchsed amount of mat
                                                                         in month 4
    s012                       menge                            purchsed amount of mat
                                                                         in month 5
    ekpo                      netpr                               net price on date criteria 1
    ekpo                      peinh                              price unit
    ekpo                      bprme                             order price unit
    ekpo                      netpr                               net price on date criteria 2
    ekpo                      peinh                              price unit
    ekpo                      bprme                             order price unit
    ekpo                      netpr                               net price on date criteria 3
    ekpo                      peinh                              price unit
    ekpo                      bprme                             order price unit
    ekpo                      netpr                               net price on date criteria 4
    ekpo                      peinh                              price unit
    ekpo                      bprme                             order price unit
    ekpo                      netpr                               net price on date criteria 5
    ekpo                      peinh                              price unit
    ekpo                      bprme                             order price unit

    Hi,
    DATA: begin of i_ekpo,
               menge........
               netpr............
               date ..........
              end of i_ekpo.
    Select menge netpr date
              from ekpo
              into table i_ekpo
             where ....
    if sy-subrc = 0.
    LOOP AT i_ekpo.
    v_month = i_ekpo-date+4(2).
    CASE v_month.
    WHEN '01'
      itab-menge1 = i_ekpo-menge.
      itab-menge5 = i_ekpo-menge.
      itab-netpr1 = i_ekpo-netpr.
      itab-netpr5 = i_ekpo-netpr.
    WHEN '02'.
      itab-menge1 = i_ekpo-menge.
      itab-menge5 = i_ekpo-menge.
      itab-netpr1 = i_ekpo-netpr.
      itab-netpr5 = i_ekpo-netpr.
    WHEN '03'.
      itab-menge1 = i_ekpo-menge.
      itab-menge5 = i_ekpo-menge.
      itab-netpr1 = i_ekpo-netpr.
      itab-netpr5 = i_ekpo-netpr.
    WHEN '12'.
      itab-menge1 = i_ekpo-menge.
      itab-menge5 = i_ekpo-menge.
      itab-netpr1 = i_ekpo-netpr.
      itab-netpr5 = i_ekpo-netpr.
    ENDCASE.
    APPEND itab.
    ENDLOOP.
    Please be more specific with some sample outputs how is should be.

  • Pls help in this query

    Hi,
    I've needed to print output like below. pls help me out .
    Thanks & Regards,
    Ramana.

    SQL> select '*****'||chr(10)||'****'||chr(10)||'***'||chr(10)||'**'||chr(10)||'*' from dual;
    '*****'||CHR(10)||'
    SQL>

Maybe you are looking for

  • Creating a GIF using CS3

    I am trying to create a GIF using CS3. I have read the discussions on Adobe but I get to a stage in the instructions and it is not working for me. I have 6 jpeg photos, and i bring them all into one. All photos are named different. After reading the

  • How to read a whole file as a set of characters (including spaces)

    Hi, I'mt trying to read a file, and i want to save each character in the file including the space character. Is there a new line char as well? I'm using this at the moment because buffer reader loses my trailing spaces, but it's only taking the first

  • E1000g driver broken on solaris 10 u6; how to report this bug correctly?

    Question also posted in OpenSolaris forums: [http://www.opensolaris.org/jive/thread.jspa?messageID=329326] While upgrading a T2000 server to solaris 10 update 6 I found that my jumbo interfaces report errors on reboot. One frequent cause was that the

  • Setting up a File Back up system. Is time machine the right option?

    Hi I own a mac pro. I currently have a 2TB drive that uses time machine. If my computer was to break down then how can i take advantage of time machine. Can i simply plug the time machine drive into a different machine and get the files i need? Or ma

  • How do I re register a mobile phone on iTunes

    I and my wife have phone , I have an iTunes account . I want het to have her done one. When I plug her phone in the computer my account comes up?