How to write complex queries in ejb2.0

Hi ,
i want to write query for search option since query depend on options choosen by user so the query is created dynamically i.e search params(table colums) may differ
.Hence i cant use ejb-ql ..... can i use hibernate if yes how can i configure ejb to use hibernate ... else is there any other way
this is related to ejb2.o ,....... i cant upgrade to ejb3.0

just as u write it in normal reports u can do the same in smartforms but it is suggested tht i u havve a custom print program do it thr and pass it thru interface
кu03B1ятu03B9к

Similar Messages

  • How to write join queries in Smartforms

    how to write join queries in Smartforms pls give me sample

    just as u write it in normal reports u can do the same in smartforms but it is suggested tht i u havve a custom print program do it thr and pass it thru interface
    кu03B1ятu03B9к

  • How to write  complex sql for this

    Hi ALL,
    I have a requirement like this
    I have 5 tables which i have to join to get the result
    but there no join column to 2 other table.
    I want to get all the applications using cobal,running on UNIX.
    How to write the query for this
    1.APP
    APP_i DESC
    1 Accounts
    2 Payments
    3 order transfer
    4 Order processing
    2.Techgy
    techid techdesc
    1 cobal
    2 Java
    3.APP_Techgy
    APP_I Techid
    1 1
    2 1
    3 1
    4 2
    4.Pltfrm
    pltfmid pltfrmdesc
    1 Windows NT
    2 UNIX
    5.APP_Pltfrm
    APP_I pltfrmid
    1 1
    2 1
    3 2
    4 2
    ouput must be
    APP_i Desc techDESC pltfrmdesc
    3 ordertranfer Cobal UNIX
    Thanks in advance

    This ('descr' in place of 'desc')?
    SQL> select a.app_i, a.descr, t.techdesc, p.pltfrmdesc
    from app_techgy atc,
       app a,
       techgy t,
       app_pltfrm ap,
       pltfrm p
    where atc.techid = t.techid
    and atc.app_i = a.app_i
    and atc.app_i = ap.app_i
    and ap.pltfrmid = p.pltfmid
    order by a.app_i
         APP_I DESCR                TECHDESC             PLTFRMDESC         
             1 accounts             cobal                windows nt         
             2 payments             cobal                windows nt         
             3 order transfer       cobal                unix               
             4 order processing     java                 unix               
    4 rows selected.

  • How to write join queries in EJBQL

    Hi
    I have a join query as follows:
    SELECT a.person_seq_id FROM fr_node_employees a,fr_nodes b,fr_node_owners c
    WHERE b.node_seq_id=c.node_seq_id AND a.node_seq_id=c.node_seq_id AND c.person_seq_id=?
    O/R mapping for tables:
    fr_node_employees - NodeEmployee
    fr_nodes - Node
    fr_node_owners - NodeOwner
    How to write this query in ejbql or can anyone give some information about ejbql will be helpful.
    Thanks,
    Satish.

    http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/queryhql.html

  • How to write Inline queries in Oracle 10g

    Hi all,
    The following Procedure is written in SQL Server 2005 . It uses Inline queries and executes it in the end . I want to write the same stored procedure in Oracle 10g.
    Could you guys please help me in doing the same .
    CREATE PROCEDURE [dbo].[proc_MDM_ShowDetails]
    @MASTERCODE VARCHAR(50),
    @MDMCode VARCHAR(50),
    @IsDrpDwnFill BIT,
    @CntryCode INT,
    @StateCode INT,
    @CityCode INT = 0,
    @GetParent INT = 0,
    @PinCode BIT = 0
    AS
    BEGIN
    DECLARE @strSQL VARCHAR(4000)
    DECLARE @TableName VARCHAR(4000)
    SET NOCOUNT ON;
    SELECT @TableName = MASTER_TABLE FROM MDM_MASTER WHERE MASTER_CODE=@MASTERCODE
    IF @IsDrpDwnFill = 0 AND @CntryCode = 0 AND @GetParent = 0
    BEGIN
    SET @strSQL = 'SELECT M.*,H.* FROM ' + @TableName + ' M LEFT JOIN MDM_HIERARCHY H ON M.MDM_MASTER_CODE=H.MASTER_CODE WHERE M.MDM_CODE=' + @MDMCode
    END
    ELSE IF @CntryCode = 0 AND @IsDrpDwnFill = 1
    BEGIN
    SET @strSQL = 'SELECT MDM_DESCRIPTION,MDM_CODE FROM ' + @TableName + ' WHERE MDM_STATUS=' + '''' + 'approved' + '''' + ' AND MDM_EXIST=1'
    END
    ELSE IF @CntryCode > 0 and @GetParent = 0
    BEGIN
    SET @strSQL = 'SELECT M.MDM_DESCRIPTION,M.MDM_CODE,H.* FROM ' + @TableName + ' M INNER JOIN MDM_HIERARCHY H ON M.MDM_MASTER_CODE=H.MASTER_CODE WHERE MDM_STATUS=' + '''' + 'approved' + '''' +
    ' AND MDM_EXIST = 1 AND MDM_PARENT_CODE =' + str(@CntryCode)
    END
    ELSE IF @StateCode > 0 and @GetParent = 0
    BEGIN
    SET @strSQL = 'SELECT MDM_DESCRIPTION,MDM_CODE FROM ' + @TableName + ' WHERE MDM_STATUS=' + '''' + 'approved' + '''' +
    ' AND MDM_EXIST = 1 AND MDM_PARENT_CODE =' + str(@StateCode)
    END
    ELSE IF @CityCode > 0 and @GetParent = 0
    BEGIN
    SET @strSQL = 'SELECT MDM_DESCRIPTION,MDM_CODE FROM ' + @TableName + ' WHERE MDM_STATUS=' + '''' + 'approved' + '''' +
    ' AND MDM_EXIST = 1 AND MDM_PARENT_CODE =' + str(@CityCode)
    END
    ELSE IF @PinCode = 1 and @GetParent = 0 and @IsDrpDwnFill = 1
    BEGIN
    SET @strSQL = 'SELECT MDM_DESCRIPTION,MDM_CODE FROM ' + @TableName + ' WHERE MDM_STATUS=' + '''' + 'approved' + '''' +
    ' AND MDM_EXIST = 1 '
    END
    ELSE IF @GetParent > 0
    BEGIN
    SET @strSQL = 'SELECT * FROM ' + @TableName + ' WHERE MDM_STATUS=' + '''' + 'approved' + '''' +
    ' AND MDM_EXIST = 1 AND MDM_CODE =' + str(@GetParent)
    END
    EXEC(@strSQL)
    SET NOCOUNT OFF;
    END
    Thanks
    Shobhit

    Hi,
    I dont know sql server 2005. But by observing it I feel you are generating sql dynamically based on condition inside the proc.
    DECLARE
       TYPE EmpCurTyp IS REF CURSOR;
       emp_cv   EmpCurTyp;
       emp_rec  employees%ROWTYPE;
       sql_stmt VARCHAR2(200);
       v_job   VARCHAR2(10) := 'ST_CLERK';
    BEGIN
       sql_stmt := 'SELECT * FROM employees WHERE job_id = :j';
       OPEN emp_cv FOR sql_stmt USING v_job;
       LOOP
         FETCH emp_cv INTO emp_rec;
         EXIT WHEN emp_cv%NOTFOUND;
         DBMS_OUTPUT.PUT_LINE('Name: ' || emp_rec.last_name || ' Job Id: ' ||
                               emp_rec.job_id);
       END LOOP;
       CLOSE emp_cv;
    END;something like this it will be. it is in oracle documentaion
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/dynamic.htm#i14500

  • How to write nested queries using DB Adapter?

    I want to write following nested query using DB Adapter can any one help...
    SELECT INVOICE_ID,FILE_NAME FROM  BILLING_INVOICE_PDF_V where FILE_ID =(
    (SELECT MAX(FILE_ID) FROM  BILLING_INVOICE_PDF_V WHERE  (INVOICE_ID = ‘12345’)));
    Thanks,
    Ram.

    Hi Ram,
    Most likely it is the semicolon at the end of the SQL statement that's causing the db adapter to throw the error; just enter the custom sql statement without a semicolon at the end.
    SELECT INVOICE_ID,FILE_NAME FROM  BILLING_INVOICE_PDF_V where FILE_ID = (SELECT MAX(FILE_ID) FROM  BILLING_INVOICE_PDF_V WHERE INVOICE_ID = '12345')

  • How to write complex query with jpa criteria builder.

    Hello,
    I want to write a query in jpa criteriaquery. Here is the query:
    SELECT node.category_name, (COUNT(parent.category_name) - 1) AS depth
    FROM category_subcategories AS node,
    category_subcategories AS parent
    WHERE node.lft BETWEEN parent.lft AND parent.rgt
    AND node.category_name = 'PORTABLE ELECTRONICS'
    GROUP BY node.category_name
    ORDER BY node.lft
    Here is the code I come up with:
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<CategorySubcategories> cq = cb.createQuery( CategorySubcategories.class );
    Root<CategorySubcategories> node = cq.from( CategorySubcategories.class );
    Root<CategorySubcategories> parent = cq.from( CategorySubcategories.class );
    Predicate p1 = cb.equal(node.get("categoryName"), categoryName);
    Predicate p2 = cb.between(node.get("lft").as(Integer.class), parent.get("lft").as(Integer.class), parent.get("rgt").as(Integer.class));
    Order nodeLft = cb.asc(node.get("lft"));
    cq.multiselect(node.get("categoryName"), cb.count(parent.get("categoryName")))
    .where(p1, p2)
    .groupBy(node.get("categoryName"))
    .orderBy(nodeLft);
    return em.createQuery(cq).getResultList();
    When I execue the test, it shown the following error:
    Testcase: testDepthOfSubtree(au.com.houseware.server.ejb.entity.facade.CategorySubcategoriesFacadeTest): Caused an ERROR
    org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [au.com.houseware.server.ejb.entity.CategorySubcategories] [select new au.com.houseware.server.ejb.entity.CategorySubcategories(generatedAlias0.categoryName, count(generatedAlias1.categoryName)) from au.com.houseware.server.ejb.entity.CategorySubcategories as generatedAlias0, au.com.houseware.server.ejb.entity.CategorySubcategories as generatedAlias1 where ( generatedAlias0.categoryName=:param0 ) and ( generatedAlias0.lft between generatedAlias1.lft and generatedAlias1.rgt ) group by generatedAlias0.categoryName]
    java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [au.com.houseware.server.ejb.entity.CategorySubcategories] [select new au.com.houseware.server.ejb.entity.CategorySubcategories(generatedAlias0.categoryName, count(generatedAlias1.categoryName)) from au.com.houseware.server.ejb.entity.CategorySubcategories as generatedAlias0, au.com.houseware.server.ejb.entity.CategorySubcategories as generatedAlias1 where ( generatedAlias0.categoryName=:param0 ) and ( generatedAlias0.lft between generatedAlias1.lft and generatedAlias1.rgt ) group by generatedAlias0.categoryName]
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1201)
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147)
    at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:324)
    at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:227)
    at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:441)
    at au.com.houseware.server.ejb.entity.facade.CategorySubcategoriesFacadeMock.findDepthOfSubtreeBy_categoryName(CategorySubcategoriesFacadeMock.java:228)
    at au.com.houseware.server.ejb.entity.facade.CategorySubcategoriesFacadeTest.testDepthOfSubtree(CategorySubcategoriesFacadeTest.java:44)
    Caused by: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [au.com.houseware.server.ejb.entity.CategorySubcategories] [select new au.com.houseware.server.ejb.entity.CategorySubcategories(generatedAlias0.categoryName, count(generatedAlias1.categoryName)) from au.com.houseware.server.ejb.entity.CategorySubcategories as generatedAlias0, au.com.houseware.server.ejb.entity.CategorySubcategories as generatedAlias1 where ( generatedAlias0.categoryName=:param0 ) and ( generatedAlias0.lft between generatedAlias1.lft and generatedAlias1.rgt ) group by generatedAlias0.categoryName]
    at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
    at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
    at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
    at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:261)
    at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
    at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
    at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
    at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
    at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
    at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
    at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
    at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
    at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:306)
    What is wrong with my criteriaQuery?
    Any suggestion is very much appreciated.
    Thanks
    Sam
    Edited by: 785102 on Mar 26, 2011 7:44 PM

    Hello,
    Thank you for your response.
    If I remove CategorySubcateogires, netbeans complained:
    incompatible types
    required: javax.persistence.criteria.CriteriaQuery<au.com.houseware.server.ejb.entity.CategorySubcategories>
    found: javax.persistence.criteria.CriteriaQuery<java.lang.Object>
    When I removed all CategorySubcategories type and replaced it with Object like this:
    public Collection<Object> findDepthOfSubtreeBy_categoryName(String categoryName) {
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<Object> c = cb.createQuery();
    Root<CategorySubcategories> node = c.from( CategorySubcategories.class );
    Root<CategorySubcategories> parent = c.from( CategorySubcategories.class );
    Predicate p1 = cb.equal(node.get("categoryName"), categoryName);
    Order nodeLft = cb.asc(node.get("lft"));
    c.multiselect(node.get("categoryName"), cb.count(parent.get("categoryName")))
    .where(p1)
    .groupBy(node.get("categoryName"))
    .orderBy(nodeLft);
    return em.createQuery(c).getResultList();
    test main():
    Collection<Object> list = ccFacade.findDepthOfSubtreeBy_categoryName("Houseware");
    for (Iterator<Object> iter = list.iterator(); iter.hasNext();) {
    CategorySubcategories cc = (CategorySubcategories) iter.next();
    System.out.println(" name : "+cc.getCategoryName());
    On execution, it thrown exception:
    [Ljava.lang.Object; cannot be cast to au.com.houseware.server.ejb.entity.CategorySubcategories
    Thanks a lot
    Sam                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • NEED YOUR HELP TO WRITE COMPLEX QUERIES FOR MULTIPLE RECHARGE

    Dear friend,
    Kindly help me out to prepare query for below scenario in telecom environment ..
    sometimes retailer do multiple recharge to same subscriber for same price points(MRP) in a day i.e Suppose in day ,a reatailer:A did recharge mrp 50 to Customer: B , Again after 5 min ,then reatailer:A did recharge mrp 50 to Customer: B again , then after 30 min ,then reatailer:A did recharge mrp 50 to Customer: B again ...similarly lot of retailer did same thing so on ....
    Kndly suggest a query for below scenario..
    1)How to get 1st recharge for customer if retailer did multiple recharge to particular customer for same price points in day ..
    2)how to get 2nd recharge for customer considering 1st scenarion i.e.a particular retailer did recharge MRP 50 three times a partucular customer in day ..then how can get 2nd one ....
    3)how can get second transaction to customer which happened after 2 mins after did 1st recharge ..considering multiple recharge scenario
    4) how can get second transaction to same customer which happened after 30 mins after did 1st reharge to customer ..considering multiple recharge scenario
    5) how can get second transaction to customer which happened between 2 mins and 5 mins after did 1st recharge to cuastomer considering multiple recharge scenario
    i have tried with below query , But it's not giving exact output .Kindly suggest qury for same .. table with column with some sample recode given below ..
    SELECT DISTINCT a.TRANSACTION_ID,a.TRASFER_DATE,b.transaction_id,
    ABS(a.TRASFER_DATE-b.TRASFER_DATE)*24*60*60,b.TRASFER_DATE next1,
    a.PROCESSING_TIME,a.RETAILER_MSISDN,a.CUSTOMER_MSISDN,a.MRP FROM SG_JK_190313 a,SG_JK_190313 b
    WHERE a.retailer_msisdn=b.RETAILER_MSISDN
    AND a.CUSTOMER_MSISDN=b.CUSTOMER_MSISDN
    AND a.MRP=b.MRP
    AND a.TRASFER_DATE!=b.TRASFER_DATE
    AND ABS(a.TRASFER_DATE-b.TRASFER_DATE)*24*60*60>120
    ORDER BY a.transaction_id
    Table Details :SG_JK_190313 it's columns:TRANSACTION_ID, TRASFER_DATE, PROCESSING_TIME, RETAILER_MSISDN, CUSTOMER_MSISDN, MRP
    transaction_id     trasfer_date processing_time     retailer_msisdn     customer_msisdn     mrp
    JKR13031900571000005     3/19/2013 0:57     0.75     7298297447     7298297447     10
    JKR13031900571000005     3/19/2013 0:57     0.75     7298297447     7298297447     10
    JKR13031900571000005     3/19/2013 0:57     0.75     7298297447     7298297447     10
    JKR13031900571000005     3/19/2013 0:57     0.75     7298297447     7298297447     10
    JKR13031911511200235     3/19/2013 11:51     0.392     7298297447     7298297447     10
    JKR13031911511200235     3/19/2013 11:51     0.392     7298297447     7298297447     10
    JKR13031911511200235     3/19/2013 11:51     0.392     7298297447     7298297447     10
    JKR13031911511200235     3/19/2013 11:51     0.392     7298297447     7298297447     10
    JKR13031915551100480     3/19/2013 15:55     0.4     7298297447     7298297447     10
    JKR13031915551100480     3/19/2013 15:55     0.4     7298297447     7298297447     10
    JKR13031915551100480     3/19/2013 15:55     0.4     7298297447     7298297447     10
    JKR13031915551100480     3/19/2013 15:55     0.4     7298297447     7298297447     10
    JKR13031922321000078     3/19/2013 22:32     0.417     7298297447     7298297447     10
    JKR13031922321000078     3/19/2013 22:32     0.417     7298297447     7298297447     10
    JKR13031922321000078     3/19/2013 22:32     0.417     7298297447     7298297447     10
    JKR13031922321000078     3/19/2013 22:32     0.417     7298297447     7298297447     10
    JKR13031905141100001     3/19/2013 5:14     0.502     7298698345     7298598324     50
    JKR13031923121000043     3/19/2013 23:12     0.404     7298698345     7298598324     50
    JKR13031905141100001     3/19/2013 5:14     0.502     7298698345     7298598324     50
    JKR13031905141100001     3/19/2013 5:14     0.502     7298698345     7298598324     50
    JKR13031907151100019     3/19/2013 7:15     0.569     7298698345     7298598324     50
    JKR13031907151100019     3/19/2013 7:15     0.569     7298698345     7298598324     50
    JKR13031907151100019     3/19/2013 7:15     0.569     7298698345     7298598324     50
    JKR13031907151100019     3/19/2013 7:15     0.569     7298698345     7298598324     50
    JKR13031907451100041     3/19/2013 7:45     0.483     7298698345     7298598324     50
    JKR13031907451100041     3/19/2013 7:45     0.483     7298698345     7298598324     50
    JKR13031907451100041     3/19/2013 7:45     0.483     7298698345     7298598324     50
    JKR13031907451100041     3/19/2013 7:45     0.483     7298698345     7298598324     50
    JKR13031923121000043     3/19/2013 23:12     0.404     7298698345     7298598324     50
    JKR13031923121000043     3/19/2013 23:12     0.404     7298698345     7298598324     50
    JKR13031923121000043     3/19/2013 23:12     0.404     7298698345     7298598324     50
    JKR13031905141100001     3/19/2013 5:14     0.502     7298698345     7298598324     50
    JKR13031901061000004     3/19/2013 1:06     0.487     9697199326     8803799846     1
    JKR13031918431100989     3/19/2013 18:43     0.323     9697199326     8803799846     1
    JKR13031918431100989     3/19/2013 18:43     0.323     9697199326     8803799846     1
    JKR13031918431100989     3/19/2013 18:43     0.323     9697199326     8803799846     1
    JKR13031918431100989     3/19/2013 18:43     0.323     9697199326     8803799846     1
    JKR13031918431100989     3/19/2013 18:43     0.323     9697199326     8803799846     1
    JKR13031918431100989     3/19/2013 18:43     0.323     9697199326     8803799846     1
    JKR13031918431100989     3/19/2013 18:43     0.323     9697199326     8803799846     1
    JKR13031901061000004     3/19/2013 1:06     0.487     9697199326     8803799846     1
    JKR13031901061000004     3/19/2013 1:06     0.487     9697199326     8803799846     1
    JKR13031901061000004     3/19/2013 1:06     0.487     9697199326     8803799846     1
    JKR13031901061000004     3/19/2013 1:06     0.487     9697199326     8803799846     1
    JKR13031901061000004     3/19/2013 1:06     0.487     9697199326     8803799846     1
    JKR13031901061000004     3/19/2013 1:06     0.487     9697199326     8803799846     1
    JKR13031900081200010     3/19/2013 0:08     0.253     9697199326     8803799846     1
    JKR13031900081200010     3/19/2013 0:08     0.253     9697199326     8803799846     1
    JKR13031900081200010     3/19/2013 0:08     0.253     9697199326     8803799846     1
    JKR13031900081200010     3/19/2013 0:08     0.253     9697199326     8803799846     1
    JKR13031900081200010     3/19/2013 0:08     0.253     9697199326     8803799846     1
    JKR13031900081200010     3/19/2013 0:08     0.253     9697199326     8803799846     1
    JKR13031900081200010     3/19/2013 0:08     0.253     9697199326     8803799846     1
    JKR13031900291100016     3/19/2013 0:29     0.464     9697199326     8803799846     1
    JKR13031900291100016     3/19/2013 0:29     0.464     9697199326     8803799846     1
    JKR13031900291100016     3/19/2013 0:29     0.464     9697199326     8803799846     1
    JKR13031900291100016     3/19/2013 0:29     0.464     9697199326     8803799846     1
    JKR13031900291100016     3/19/2013 0:29     0.464     9697199326     8803799846     1
    JKR13031900291100016     3/19/2013 0:29     0.464     9697199326     8803799846     1
    JKR13031900291100016     3/19/2013 0:29     0.464     9697199326     8803799846     1
    JKR13031900191000011     3/19/2013 0:19     0.302     9697199326     8803799846     1
    JKR13031900191000011     3/19/2013 0:19     0.302     9697199326     8803799846     1
    JKR13031900191000011     3/19/2013 0:19     0.302     9697199326     8803799846     1
    JKR13031900191000011     3/19/2013 0:19     0.302     9697199326     8803799846     1
    JKR13031900191000011     3/19/2013 0:19     0.302     9697199326     8803799846     1
    JKR13031900191000011     3/19/2013 0:19     0.302     9697199326     8803799846     1
    JKR13031918501101022     3/19/2013 18:50     2.231     9697199326     8803799846     1
    JKR13031918501101022     3/19/2013 18:50     2.231     9697199326     8803799846     1
    JKR13031918501101022     3/19/2013 18:50     2.231     9697199326     8803799846     1
    JKR13031918501101022     3/19/2013 18:50     2.231     9697199326     8803799846     1
    JKR13031918501101022     3/19/2013 18:50     2.231     9697199326     8803799846     1
    JKR13031918501101022     3/19/2013 18:50     2.231     9697199326     8803799846     1
    JKR13031918501101022     3/19/2013 18:50     2.231     9697199326     8803799846     1
    JKR13031918371101555     3/19/2013 18:37     0.376     9697199326     8803799846     1
    JKR13031918371101555     3/19/2013 18:37     0.376     9697199326     8803799846     1
    JKR13031918371101555     3/19/2013 18:37     0.376     9697199326     8803799846     1
    JKR13031918371101555     3/19/2013 18:37     0.376     9697199326     8803799846     1
    JKR13031918371101555     3/19/2013 18:37     0.376     9697199326     8803799846     1
    JKR13031918371101555     3/19/2013 18:37     0.376     9697199326     8803799846     1
    JKR13031918371101555     3/19/2013 18:37     0.376     9697199326     8803799846     1
    JKR13031900191000011     3/19/2013 0:19     0.302     9697199326     8803799846     1
    JKR13031920541100321     3/19/2013 20:54     0.373     9858998396     9858998396     10
    JKR13031920541100321     3/19/2013 20:54     0.373     9858998396     9858998396     10
    JKR13031917321000533     3/19/2013 17:32     0.361     9858998396     9858998396     10
    JKR13031917321000533     3/19/2013 17:32     0.361     9858998396     9858998396     10
    JKR13031917321000533     3/19/2013 17:32     0.361     9858998396     9858998396     10
    JKR13031913071200251     3/19/2013 13:07     0.422     9858998396     9858998396     10
    JKR13031913071200251     3/19/2013 13:07     0.422     9858998396     9858998396     10
    JKR13031920541100321     3/19/2013 20:54     0.373     9858998396     9858998396     10
    JKR13031913071200251     3/19/2013 13:07     0.422     9858998396     9858998396     10
    Regards
    Srikanta Parida

    PFB sample data of table .Kindely prepare the query..
    transaction_id     trasfer_date     processing_time     retailer_msisdn     customer_msisdn     mrp
    JKR13031900571000005     19/Mar/2013 12:57:51 AM     0.75     7298297447     7298297447     10
    JKR13031900571000005     19/Mar/2013 12:57:51 AM     0.75     7298297447     7298297447     10
    JKR13031900571000005     19/Mar/2013 12:57:51 AM     0.75     7298297447     7298297447     10
    JKR13031900571000005     19/Mar/2013 12:57:51 AM     0.75     7298297447     7298297447     10
    JKR13031911511200235     19/Mar/2013 11:51:19 AM     0.39     7298297447     7298297447     10
    JKR13031911511200235     19/Mar/2013 11:51:19 AM     0.39     7298297447     7298297447     10
    JKR13031911511200235     19/Mar/2013 11:51:19 AM     0.39     7298297447     7298297447     10
    JKR13031911511200235     19/Mar/2013 11:51:19 AM     0.39     7298297447     7298297447     10
    JKR13031915551100480     19/Mar/2013 03:55:50 PM     0.40     7298297447     7298297447     10
    JKR13031915551100480     19/Mar/2013 03:55:50 PM     0.40     7298297447     7298297447     10
    JKR13031915551100480     19/Mar/2013 03:55:50 PM     0.40     7298297447     7298297447     10
    JKR13031915551100480     19/Mar/2013 03:55:50 PM     0.40     7298297447     7298297447     10
    JKR13031922321000078     19/Mar/2013 10:32:34 PM     0.42     7298297447     7298297447     10
    JKR13031922321000078     19/Mar/2013 10:32:34 PM     0.42     7298297447     7298297447     10
    JKR13031922321000078     19/Mar/2013 10:32:34 PM     0.42     7298297447     7298297447     10
    JKR13031922321000078     19/Mar/2013 10:32:34 PM     0.42     7298297447     7298297447     10
    JKR13031905141100001     19/Mar/2013 05:14:11 AM     0.50     7298698345     7298598324     50
    JKR13031923121000043     19/Mar/2013 11:12:55 PM     0.40     7298698345     7298598324     50
    JKR13031905141100001     19/Mar/2013 05:14:11 AM     0.50     7298698345     7298598324     50
    JKR13031905141100001     19/Mar/2013 05:14:11 AM     0.50     7298698345     7298598324     50
    JKR13031907151100019     19/Mar/2013 07:15:05 AM     0.57     7298698345     7298598324     50
    JKR13031907151100019     19/Mar/2013 07:15:05 AM     0.57     7298698345     7298598324     50
    JKR13031907151100019     19/Mar/2013 07:15:05 AM     0.57     7298698345     7298598324     50
    JKR13031907151100019     19/Mar/2013 07:15:05 AM     0.57     7298698345     7298598324     50
    JKR13031907451100041     19/Mar/2013 07:45:13 AM     0.48     7298698345     7298598324     50
    JKR13031907451100041     19/Mar/2013 07:45:13 AM     0.48     7298698345     7298598324     50
    JKR13031907451100041     19/Mar/2013 07:45:13 AM     0.48     7298698345     7298598324     50
    JKR13031907451100041     19/Mar/2013 07:45:13 AM     0.48     7298698345     7298598324     50
    JKR13031923121000043     19/Mar/2013 11:12:55 PM     0.40     7298698345     7298598324     50
    JKR13031923121000043     19/Mar/2013 11:12:55 PM     0.40     7298698345     7298598324     50
    JKR13031923121000043     19/Mar/2013 11:12:55 PM     0.40     7298698345     7298598324     50
    JKR13031905141100001     19/Mar/2013 05:14:11 AM     0.50     7298698345     7298598324     50
    JKR13031901061000004     19/Mar/2013 01:06:39 AM     0.49     9697199326     8803799846     1
    JKR13031918431100989     19/Mar/2013 06:43:37 PM     0.32     9697199326     8803799846     1
    JKR13031918431100989     19/Mar/2013 06:43:37 PM     0.32     9697199326     8803799846     1
    JKR13031918431100989     19/Mar/2013 06:43:37 PM     0.32     9697199326     8803799846     1
    JKR13031918431100989     19/Mar/2013 06:43:37 PM     0.32     9697199326     8803799846     1
    JKR13031918431100989     19/Mar/2013 06:43:37 PM     0.32     9697199326     8803799846     1
    JKR13031918431100989     19/Mar/2013 06:43:37 PM     0.32     9697199326     8803799846     1
    JKR13031918431100989     19/Mar/2013 06:43:37 PM     0.32     9697199326     8803799846     1
    JKR13031901061000004     19/Mar/2013 01:06:39 AM     0.49     9697199326     8803799846     1
    JKR13031901061000004     19/Mar/2013 01:06:39 AM     0.49     9697199326     8803799846     1
    JKR13031901061000004     19/Mar/2013 01:06:39 AM     0.49     9697199326     8803799846     1
    JKR13031901061000004     19/Mar/2013 01:06:39 AM     0.49     9697199326     8803799846     1
    JKR13031901061000004     19/Mar/2013 01:06:39 AM     0.49     9697199326     8803799846     1
    JKR13031901061000004     19/Mar/2013 01:06:39 AM     0.49     9697199326     8803799846     1
    JKR13031900081200010     19/Mar/2013 12:08:11 AM     0.25     9697199326     8803799846     1
    JKR13031900081200010     19/Mar/2013 12:08:11 AM     0.25     9697199326     8803799846     1
    JKR13031900081200010     19/Mar/2013 12:08:11 AM     0.25     9697199326     8803799846     1
    JKR13031900081200010     19/Mar/2013 12:08:11 AM     0.25     9697199326     8803799846     1
    JKR13031900081200010     19/Mar/2013 12:08:11 AM     0.25     9697199326     8803799846     1
    JKR13031900081200010     19/Mar/2013 12:08:11 AM     0.25     9697199326     8803799846     1
    JKR13031900081200010     19/Mar/2013 12:08:11 AM     0.25     9697199326     8803799846     1
    JKR13031900291100016     19/Mar/2013 12:29:38 AM     0.46     9697199326     8803799846     1
    JKR13031900291100016     19/Mar/2013 12:29:38 AM     0.46     9697199326     8803799846     1
    JKR13031900291100016     19/Mar/2013 12:29:38 AM     0.46     9697199326     8803799846     1
    JKR13031900291100016     19/Mar/2013 12:29:38 AM     0.46     9697199326     8803799846     1
    JKR13031900291100016     19/Mar/2013 12:29:38 AM     0.46     9697199326     8803799846     1
    JKR13031900291100016     19/Mar/2013 12:29:38 AM     0.46     9697199326     8803799846     1
    JKR13031900291100016     19/Mar/2013 12:29:38 AM     0.46     9697199326     8803799846     1
    JKR13031900191000011     19/Mar/2013 12:19:51 AM     0.30     9697199326     8803799846     1
    JKR13031900191000011     19/Mar/2013 12:19:51 AM     0.30     9697199326     8803799846     1
    JKR13031900191000011     19/Mar/2013 12:19:51 AM     0.30     9697199326     8803799846     1
    JKR13031900191000011     19/Mar/2013 12:19:51 AM     0.30     9697199326     8803799846     1
    JKR13031900191000011     19/Mar/2013 12:19:51 AM     0.30     9697199326     8803799846     1
    JKR13031900191000011     19/Mar/2013 12:19:51 AM     0.30     9697199326     8803799846     1
    JKR13031918501101022     19/Mar/2013 06:50:40 PM     2.23     9697199326     8803799846     1
    JKR13031918501101022     19/Mar/2013 06:50:40 PM     2.23     9697199326     8803799846     1
    JKR13031918501101022     19/Mar/2013 06:50:40 PM     2.23     9697199326     8803799846     1
    JKR13031918501101022     19/Mar/2013 06:50:40 PM     2.23     9697199326     8803799846     1
    JKR13031918501101022     19/Mar/2013 06:50:40 PM     2.23     9697199326     8803799846     1
    JKR13031918501101022     19/Mar/2013 06:50:40 PM     2.23     9697199326     8803799846     1
    JKR13031918501101022     19/Mar/2013 06:50:40 PM     2.23     9697199326     8803799846     1
    JKR13031918371101555     19/Mar/2013 06:37:59 PM     0.38     9697199326     8803799846     1
    JKR13031918371101555     19/Mar/2013 06:37:59 PM     0.38     9697199326     8803799846     1
    JKR13031918371101555     19/Mar/2013 06:37:59 PM     0.38     9697199326     8803799846     1
    JKR13031918371101555     19/Mar/2013 06:37:59 PM     0.38     9697199326     8803799846     1
    JKR13031918371101555     19/Mar/2013 06:37:59 PM     0.38     9697199326     8803799846     1
    JKR13031918371101555     19/Mar/2013 06:37:59 PM     0.38     9697199326     8803799846     1
    JKR13031918371101555     19/Mar/2013 06:37:59 PM     0.38     9697199326     8803799846     1
    JKR13031900191000011     19/Mar/2013 12:19:51 AM     0.30     9697199326     8803799846     1
    JKR13031920541100321     19/Mar/2013 08:54:23 PM     0.37     9858998396     9858998396     10
    JKR13031920541100321     19/Mar/2013 08:54:23 PM     0.37     9858998396     9858998396     10
    JKR13031917321000533     19/Mar/2013 05:32:39 PM     0.36     9858998396     9858998396     10
    JKR13031917321000533     19/Mar/2013 05:32:39 PM     0.36     9858998396     9858998396     10
    JKR13031917321000533     19/Mar/2013 05:32:39 PM     0.36     9858998396     9858998396     10
    JKR13031913071200251     19/Mar/2013 01:07:22 PM     0.42     9858998396     9858998396     10
    JKR13031913071200251     19/Mar/2013 01:07:22 PM     0.42     9858998396     9858998396     10
    JKR13031920541100321     19/Mar/2013 08:54:23 PM     0.37     9858998396     9858998396     10
    JKR13031913071200251     19/Mar/2013 01:07:22 PM     0.42     9858998396     9858998396     10
    Edited by: user3558544 on Apr 5, 2013 5:55 AM

  • How to map complex queries to ADF

    I have an SQL query that I would like to map to ADF business components but am having difficulty.
    The query is:
    SELECT ENTA.KEYA, ENTA.ATTA1, ENTB.ATTB1 FROM ENTA, ENTB WHERE (ENTA.KEYA = '?') AND (ENTA.ATTA2 = ENTB.KEYB) AND (ENTA.ATTA1 BETWEEN ? AND (SELECT MIN(ENTA.ATTA1) FROM ENTA , ENTB WHERE (ENTA.ATTA2 = ENTB.KEYB) AND (ENTB.ATTB2 = 'D') AND (ENTA.KEYA = '?') AND (ENTA.ATTA1 >= ?)))
    I don't know if I should use one view object for the inner query or one view object for the whole query. Whatever I try I still have problems with the ViewLink.
    To make matters more complicated parameters 1 and 3 are identical as are parameters 2 and 4.
    Can anyone help?

    Stephen,
    if the problem is that you cannot execute the query in teh BC4J tester, then this is because it doesn't support testing with parameters.
    Another way of doing what you want is to create two EO and then have the VO select the attributes from both. However, to do the filtering you still need to add parameters to the query.
    Frank

  • Complex queries in Open SQL

    Moved to performance forum by moderator
    Hi Experts,
    This is more of a discussion rather than a question. I would like to know the advantages of Open SQL. It prevents you from writing complex queries, the kind of queries that you can write in native sql.
    The biggest disadvantage I feel is that you have to fetch data into internal tables and loop. This takes a lot of processing time when you have a report having a lot of lines. A complex query using complex joins and subqueries will always perform better than having to loop and process data and simple things like generating sequence.
    The best thing about open sql is the way it handles select options.
    I would like to get your opinions and suggestions how to write complex queries in ABAP with some code snippets if possible.
    Warm Regards,
    Abdullah
    Edited by: Matt on Jan 21, 2009 6:54 PM

    > select - endselect will query the database repeatedly and wont be any different from using a loop on
    > internal table.
    that is a  very common misunderstanding, but not true, it uses the arry interface, but gives you the possibility to react on every line. But interaction with DB is in blocks.
    The biggest advantage of Open SQL is the implementation of the table buffer, every Open SQL Statement checks the buffers first.
    Other advantage, all statements changing table definitions are not allowed.
    And of course, as already said, it is a set of commands available on all DB platforms certified for SAP software, i.e. IBM, Oracle, Max DB and Microsoft.
    Complex queries, even with the available joins you can write very very complex queries ... sometimes too complex. I see not advantage for a competetion of writing the most complex statement
    Siegfried

  • Want complex queries

    Hi,
    Where can i find the SQL queries(unsolved) through which i can learn to write complex queries...
    As I am a novice programmer it would be better if the range varies from easy to complex ones.
    Thanks in advance.
    Mythili

    Actually for me a skill full SQL developer is one who can solve a complex problem with a simple SQL. Not the one who can write complex SQL ;)
    Some of the places from where i learn new and exiting stuff ever day are
    [Asktom.oracl.com |http://asktom.oracle.com/pls/asktom/f?p=100:1:146758316283624]
    [forums.oracle.com|http://forums.oracle.com/forums/main.jspa?categoryID=84]
    [Richard footes oracle blog|http://richardfoote.wordpress.com/]
    [Oracle Document is always there|http://tahiti.oracle.com/]
    These places are not going to make you a great SQL Developer in a day. You have to be there and keep learning constantly. Without your knowledge over a period of time your approach towards SQL will change. And change is good ;)

  • How to write queries more efficiently? Please Help a sinking guy

    Hello Query Guru's,
      I am having issue writing the SQL statements efficiently, please help/guide me to learn how to write SQL’s more efficiently and logically. At my work I am being a fun every day by my team when comes the coding please guide me to become an efficient query writer. I am starving and ready to do hard work but need to know the correct path.
    Thanks in Advance.

    You could pick up examples from introductory books on Oracle.
    For example the Certification Guides for the Oracle SQL Fundamentals Guide  (1Z0-051 http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=5001&get_params=p_exam_id:1Z0-051&p_org_id=&lang=    ) .  Search bookstores / amazon.com  for books for 1Z0-051
    You could also look at Jason Price's book Oracle Database 11g SQL  :  http://www.amazon.com/Oracle-Database-11g-SQL-Press/dp/0071498508/ref=sr_1_1?ie=UTF8&qid=1372742972&sr=8-1&keywords=Jason+Price
    Hemant K Chitale

  • How to write a java function for use in where clause in SQL statement

    Hi,
    Does anyone know a good tutorial on how to write and include a Java class/function into Oracle.
    I'd like to write mathematical function to use in my queries, but the resources available in PL/SQL are very limited.
    Many thanx

    Pim,
    I see you got an answer in the PL/SQL forum.
    But in case you haven't seen it, perhaps this Web page will help:
    http://www.oracle.com/technology/tech/java/jsp/index.html
    Good Luck,
    Avi.

  • How to write this assignment in oom way(long)

    i try to write a new class, but i am not very sure if there is only one new class, I shall write a Movie class or a Ticket class?
    this is my Movie class, if I also want to write a new Ticket class. and still i don't know how to write
    because the Ticket class uses some of the attributes of the Movie class such as start time, Movie.name, as in this situation the relation
    between Ticket and Movie is still aggregation, or become a generalization?
    and how to represent that a Movie can have many Tickets? I shall write a buy-ticket method inside the Ticket class or Movie class.
    (are there any thing not right with this movie class? thanks)
    ============================
    class Movie
         String name;
         String startTime;
         String [] coupleChair=new String[11];//start from 1 to 10
         String [] singleChair=new String[11];//start from 1 to 10     
         public Movie(String str1st)
              this.name=str1st;
         public Movie(String str1st, String str2nd)
              this.name=str1st;
              this.startTime=str2nd;
         public String buyA_Single_Ticket()
              int i=1;
              do
                   if(this.singleChair!="sold")
                        this.singleChair[i]="sold";
                        return "You seat is Single Seat No."+i+"\n Enjoy the movie :)";
                   else i++;
              while(i<=10);//when i==11 jump out
              return "Sorry, all Single seats have been sold Out";
         public String buyA_Couple_Ticket()
              int i=1;
              do
                   if(this.coupleChair[i]!="sold")
                        this.coupleChair[i]="sold";
                        return "You seat is Couple Seat No."+i+"\n Enjoy the time ;)";
                   else i++;
              while(i<=10);//when i==11 jump out
              return "Sorry, all Couple seats have been sold Out";
    }//end class
    ============================
    this is the question
    A small ABC cinema has just purchased a computer for its new automated reservations system. You have been asked to program the new system. You are to write a Java application to assign seats on each movie show on the day (capacity: 20 seats for 1 movie).
    Your program should display the following alternatives: ��Please type 1 for couple seat section�� and ��Please type 2 for normal seat section��. If the user types 1, your program should assign one seat in the couple seat section (seats 1 �C 10). If the person types 2, your program should assign a seat in the normal seat (seats 11 �C 20). Your program should also prompt for the movie time and movie name.
    Your program should then display:
    I.     The person��s seat number
    II.     Whether it is a couple seat or normal seat of the cinema
    III.     Time, date, movie name
    Your program should never assign a seat that has already been assigned. When the normal seat section is full, your program should ask the person if it is acceptable to be placed in the couple seat section (and vice versa). If yes, make the appropriate seat assignment. If no, print the message ��Next show is in 3 hours time.��
    (it is just a small test on my OOM learning, I know it is not necessary to make it so complex.)

    Break down your problem into discrete chunks. The more you practice this, the more your initial thoughts will resemble the eventual objects that you will create.
    Let's take address a few of your issues:
    What has the start time? Is it the ticket or the movie? (Hint: Would someone ever print you out a ticket with a different start time than the movie's?)
    If ticket and movie share some attributes, then you can either use inheritance or composition/delegation. In this instance, what makes more sense to you? Is a ticket a movie or vice versa? Or is a ticket simply related to a movie?
    If a given object can contain several instances of another object, you will want to use either an array or a collection, probably List in this instance.
    Why is there no Theater object? A movie may play at multiple theaters. Each theater has a capacity (in terms of total seats and number already booked). This does not really have anything to do with the movie. It is the Theater that you are booking. It may also have which movies are showing at which time.
    Your notion of 'couple' booking seems strange. Why not have a concept like 'consecutive seats required'? That way, your design is more flexible and you can still accomodate couples.That should get you started. Best of luck.
    - Saish

  • How to write this sql query in php code ?

    for example:
    insert into temp
    select *
    from testtable;
    after this, i will query data from sql below:
    select *
    from temp;
    how to write this php code ?
    who can help me ?
    thanks!

    Have a look at the manual to find out how to issue queries.
    http://us3.php.net/oci8

Maybe you are looking for

  • How can I connect to Bluetooth of my iPhone when the screen is off ? (Bluetooth is ON)

    I need to "Page" my iPhone whenever its Bluetooth is ON. I couldn't figure it out how long is the listening time of the Apple's Bluetooth when its in Idle mode. Does anybody know how is the procedure of Apple devices to listen for available paging? I

  • APEX page displays correctly in Firefox but not in IE7 nor IE8

    I have an APEX 4.0 page which displays two columns of data. In Firefox, where the border for column one should end, it does. Then the column two data is displayed right next to column one (correctly). In IE, there is a gap of blank space between the

  • Best export settings for iDVD?

    Is there something better than "Share to Large"? Last night I tried an export to QT as DV ("best quality", 1440x1080, interlaced 4:3) and this produced hideous results when encoded onto the DVD. Very jagged edges. Surprising, since the exported movie

  • Computer won't load Windows after installing new CPU fan

    My wife's computer's CPU fan quit working so she bought a new one and installed it just now. She turned the compuer on and it  says "Windows failed to Start. A recent hardware or software change might be the cause."If Windows files have been damaged

  • Sppsvc is maxing out cpu core

    I don't understand why sppsvc has such high CPU usage all the time. When you run loads of virtual machines, it's basically maxing out the CPU. All the windows server installations seem to have this problem (guests and hosts). I haven't installed anyt