SQL query perfomance is bad, Need suggestion on creating proper index

Hello Team,
I am executing below query on a 8 Million rows table, This query is taking around 2.5 minutes, Could some one suggest me a some index criteria which can improve my query response time to milli seconds.
SELECT c4_pvcx0.sy_objectid, c4_pvcx0.sy_objectid, c4_pvcx0.sy_objectid FROM c4_pvcx c4_pvcx0 WHERE c4_pvcx0.c4_az_iosqos = 'C4ir00018}' AND c4_pvcx0.sy_objectid != 'C4vd00F}iD' AND c4_pvcx0.sy_pendoperation != 2 AND (c4_pvcx0.sy_changeorderid = 'SYxf0003Ga' AND c4_pvcx0.sy_version = 1 OR c4_pvcx0.sy_version = 0 AND NOT (c4_pvcx0.sy_objectid IN (SELECT c4_pvcx0.sy_objectid FROM c4_pvcx c4_pvcx0 WHERE c4_pvcx0.sy_changeorderid = 'SYxf0003Ga' AND c4_pvcx0.sy_version = 1))) ORDER BY c4_pvcx0.sy_objectid ASC
Table definition is
  CREATE TABLE "C4_PVCX"
   (     "SY_OBJECTID" CHAR(10 BYTE) NOT NULL ENABLE,
     "SY_CREATEDDATE" VARCHAR2(24 BYTE) NOT NULL ENABLE,
     "SY_MODIFIEDDATE" VARCHAR2(24 BYTE) NOT NULL ENABLE,
     "SY_COMMITTEDDATE" VARCHAR2(24 BYTE) NOT NULL ENABLE,
     "SY_SEQUENCENUMBER" NUMBER(*,0),
     "SY_CHANGEORDERID" CHAR(10 BYTE) NOT NULL ENABLE,
     "SY_VERSION" NUMBER(*,0),
     "SY_PENDOPERATION" NUMBER(*,0),
     "SY_SNOOKERSEQNUM" NUMBER(*,0),
     "VPN" VARCHAR2(16 BYTE) NOT NULL ENABLE,
     "DOMAIN" VARCHAR2(16 BYTE) NOT NULL ENABLE,
     "SRAZ_BANDWIDTH" NUMBER(*,0),
     "SRZA_BANDWIDTH" NUMBER(*,0),
     "SRBACKUPROLE" VARCHAR2(12 BYTE) NOT NULL ENABLE,
     "SRA_CONSUME_BW" VARCHAR2(5 BYTE) NOT NULL ENABLE,
     "SRZ_CONSUME_BW" VARCHAR2(5 BYTE) NOT NULL ENABLE,
     "SRPRIORITY" NUMBER(*,0),
     "SRUNIPRIORITY" NUMBER(*,0),
     "SRA_PRIMTP" VARCHAR2(44 BYTE) NOT NULL ENABLE,
     "SRZ_PRIMTP" VARCHAR2(44 BYTE) NOT NULL ENABLE,
     "SRNAME" VARCHAR2(64 BYTE) NOT NULL ENABLE,
     "SRDESTSERV" VARCHAR2(32 BYTE) NOT NULL ENABLE,
     "SRCOST" NUMBER(*,0),
     "SREMSADMINSTATUS" VARCHAR2(16 BYTE) NOT NULL ENABLE,
     "SRA_CONSUME_CID" VARCHAR2(5 BYTE) NOT NULL ENABLE,
     "SRZ_CONSUME_CID" VARCHAR2(5 BYTE) NOT NULL ENABLE,
     "RATYPE" VARCHAR2(4 BYTE) NOT NULL ENABLE,
     "RAA_VCI" NUMBER(*,0),
     "RAZ_VCI" NUMBER(*,0),
     "RAA_VPI" NUMBER(*,0),
     "RAZ_VPI" NUMBER(*,0),
     "RA_FRTT" NUMBER(*,0),
     "RAQOS" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAA_FRDISC" VARCHAR2(5 BYTE) NOT NULL ENABLE,
     "RAZ_FRDISC" VARCHAR2(5 BYTE) NOT NULL ENABLE,
     "RAAZ_TDTYPE" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAAZ_SCR" NUMBER(*,0),
     "RAAZ_PCR" NUMBER(*,0),
     "RAAZ_MBS" NUMBER(*,0),
     "RAAZ_CDVT" NUMBER(*,0),
     "RAAZ_MCR" NUMBER(*,0),
     "RAAZ_CDV" NUMBER(*,0),
     "RAAZ_MAXCTD" NUMBER(*,0),
     "RAAZ_CLR" NUMBER(*,0),
     "RAZA_TDTYPE" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAZA_SCR" NUMBER(*,0),
     "RAZA_PCR" NUMBER(*,0),
     "RAZA_MBS" NUMBER(*,0),
     "RAZA_CDVT" NUMBER(*,0),
     "RAZA_MCR" NUMBER(*,0),
     "RAZA_CDV" NUMBER(*,0),
     "RAZA_MAXCTD" NUMBER(*,0),
     "RAZA_CLR" NUMBER(*,0),
     "RAAZ_ICR" NUMBER(*,0),
     "RAAZ_RIF" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAAZ_NRM" NUMBER(*,0),
     "RAAZ_RDF" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAAZ_ADTF" NUMBER(*,0),
     "RAAZ_TRM" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAAZ_TBE" NUMBER(*,0),
     "RAAZ_CDF" VARCHAR2(4 BYTE) NOT NULL ENABLE,
     "RAZA_ICR" NUMBER(*,0),
     "RAZA_RIF" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAZA_NRM" NUMBER(*,0),
     "RAZA_RDF" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAZA_ADTF" NUMBER(*,0),
     "RAZA_TRM" VARCHAR2(8 BYTE) NOT NULL ENABLE,
     "RAZA_TBE" NUMBER(*,0),
     "RAZA_CDF" VARCHAR2(4 BYTE) NOT NULL ENABLE,
     "C4PVC_ID" VARCHAR2(40 BYTE) NOT NULL ENABLE,
     "C4AZ_UPC" VARCHAR2(4 BYTE) NOT NULL ENABLE,
     "C4ZA_UPC" VARCHAR2(4 BYTE) NOT NULL ENABLE,
     "C4AZ_CAST" VARCHAR2(12 BYTE) NOT NULL ENABLE,
     "C4ZA_CAST" VARCHAR2(12 BYTE) NOT NULL ENABLE,
     "C4AZ_QOSINDEX" NUMBER(*,0),
     "C4ZA_QOSINDEX" NUMBER(*,0),
     "SRPROFILE" CHAR(10 BYTE) NOT NULL ENABLE,
     "SRNODE" CHAR(10 BYTE) NOT NULL ENABLE,
     "SRNETWORK" CHAR(10 BYTE) NOT NULL ENABLE,
     "SRA_TP" CHAR(10 BYTE) NOT NULL ENABLE,
     "SRZ_TP" CHAR(10 BYTE) NOT NULL ENABLE,
     "SRSOID" CHAR(10 BYTE) NOT NULL ENABLE,
     "C4_AZ_IOSQOS" CHAR(10 BYTE) NOT NULL ENABLE,
     "C4_ZA_IOSQOS" CHAR(10 BYTE) NOT NULL ENABLE
Currently i have below indexes on this table.
  CREATE UNIQUE INDEX  "C4_PVCX_IDX" ON "PRFT1"."C4_PVCX" ("SY_OBJECTID", "SY_VERSION")
  CREATE UNIQUE INDEX    "C4_PVCX CR" ON "PRFT1"."C4_PVCX" ("SY_CHANGEORDERID", "SY_OBJECTID", "SY_VERSION")
  CREATE INDEX "C4_PVCX_CD" ON "PRFT1"."C4_PVCX" ("SY_COMMITTEDDATE")
Execution Plan
Plan hash value: 1884930072
| Id  | Operation           | Name       | Rows  | Bytes | Cost (%CPU)| Time
|
|   0 | SELECT STATEMENT    |            |   795 | 30210 | 73650   (5)| 00:14:44
|
|   1 |  SORT ORDER BY      |            |   795 | 30210 | 73650   (5)| 00:14:44
|
|*  2 |   FILTER            |            |       |       |            |
|
|*  3 |    TABLE ACCESS FULL| C4_PVCX    | 15909 |   590K| 73646   (5)| 00:14:44
|
|*  4 |    INDEX UNIQUE SCAN| C4_PVCX_CR |     1 |    24 |     3   (0)| 00:00:01
|
Predicate Information (identified by operation id):
   2 - filter("C4_PVCX0"."SY_VERSION"=0 AND  NOT EXISTS (SELECT /*+ */ 0
              FROM "PRFT1"."C4_PVCX" "C4_PVCX0" WHERE "C4_PVCX0"."SY_VERSION"=1
AND
              "C4_PVCX0"."SY_OBJECTID"=:B1 AND "C4_PVCX0"."SY_CHANGEORDERID"='SY
xf0003Ga
              ') OR "C4_PVCX0"."SY_VERSION"=1 AND "C4_PVCX0"."SY_CHANGEORDERID"=
'SYxf000
              3Ga')
   3 - filter("C4_PVCX0"."C4_AZ_IOSQOS"='C4ir00018}' AND
              "C4_PVCX0"."SY_PENDOPERATION"<>2 AND
              "C4_PVCX0"."SY_OBJECTID"<>'C4vd00F}iD')
   4 - access("C4_PVCX0"."SY_CHANGEORDERID"='SYxf0003Ga' AND
              "C4_PVCX0"."SY_OBJECTID"=:B1 AND "C4_PVCX0"."SY_VERSION"=1)
Statistics
          0  recursive calls
          0  db block gets
     296336  consistent gets
     294809  physical reads
          0  redo size
        466  bytes sent via SQL*Net to client
        480  bytes received via SQL*Net from client
          1  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          0  rows processedThanks & Regards
Satish
Edited by: Satish Kumar Ballepu on May 16, 2009 2:54 AM

before index creation. check "OR" condition in your query.
that query means below code
AND    ((c4_pvcx0.sy_changeorderid = 'SYxf0003Ga'AND c4_pvcx0.sy_version = 1)
                                                OR  (c4_pvcx0.sy_version = 0)  --> rerturn rows  "sy_version=0" without sy_changeorderid condition"
        AND NOT ( c4_pvcx0.sy_objectid IN (
                                           SELECT c4_pvcx0.sy_objectid
                                           FROM   c4_pvcx c4_pvcx0
                                           WHERE  c4_pvcx0.sy_changeorderid = 'SYxf0003Ga'
                                           AND    c4_pvcx0.sy_version = 1
{code}
is it right?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • SQL query....need help again

    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
    write a query for this QUESTION:
    for each movie, list the movie number, the average pay and the total number of actors in the movie.....

    hi - didn't you read my response to your other nearly identical thread?
    SQL query...pls help ASAP
    may I suggest you get a basic book on oracle SQL and immerse yourself for a few hours before comming to this forum for answers to your homework questions?

  • Using a SQL Query Group by is needed

    Hi All,
    Scenario Below:
    we have 2 Transactions, 5 Lines and each line is having 2 Taxes correspondingly. We have few more formula columns which are calculating based on requirements.
    We need to Group the amount at Line level for the one specific TAX.
    say: L1 1, L2 2, L3 3, L4 4, L5 5. for one tax having L1, L2 and L3 which needs to be sum up 6
    and for other tax needs to sum up to 9.
    But, we need to display all the Lines.
    Regards,
    Reddy.

    Hi, Reddy,
    Use the analytic SUM function instead of the aggregate function if you don't want to get only one line of output per group.
    Since I don't have a copy of your table, I'll use the scott.emp table to illustrate.
    The following query gets some information about individual employees, along with the total salary of all the employees with the same job:
    SELECT       job
    ,       ename
    ,       sal
    ,       SUM (sal) OVER (PARTITION BY  job)     AS total_sal
    FROM       scott.emp
    ORDER BY  job
    ;Output:
    JOB       ENAME             SAL  TOTAL_SAL
    ANALYST   SCOTT            3000       6000
    ANALYST   FORD             3000       6000
    CLERK     MILLER           1300       4150
    CLERK     JAMES             950       4150
    CLERK     SMITH             800       4150
    CLERK     ADAMS            1100       4150
    MANAGER   BLAKE            2850       8275
    MANAGER   JONES            2975       8275
    MANAGER   CLARK            2450       8275
    PRESIDENT KING             5000       5000
    SALESMAN  TURNER           1500       5600
    SALESMAN  MARTIN           1250       5600
    SALESMAN  WARD             1250       5600
    SALESMAN  ALLEN            1600       5600Almost all of the aggregate functions (including SUM, AVG, COUNT, MIN, even user-defined aggregate functions like STRAGG) have analytic counterparts. The keyword OVER after the argument list marks the function as analytic.
    The analytic PARTITION BY clause corresponds to the aggregate GROUP BY.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    It never hurts to say what version of Oracle you're using.

  • Need suggestion for creating 'whispy smoke'

    Hi All,
    I'm trying to figure out a way to create a cartoonish looking whispy smoke. I've played with Trapcode Particular and that creates some very realistic looking smoke, probably too realistic.  I've played with CC Particle World, and also tried painting the smoke and then animated it on with a mask and a stroke set to reveal the original based on the mask.  Nothing really gets close to what I'm looking for.  Here's a sample of the client's original art:
    Any suggestions for how to achieve this?
    Thanks,
    CJ

    Trapcode 3D Stroke with taper enabled.
    Mylenium

  • Need Suggestions to Create this Effect

    Using Premiere Elements 12 on Mac, I want to create the effect of a wallpaper showing ballet dancer images, then having them appear to "dance" where they first appear. I have not been able to figure out how to insert active gifs to do this. Would welcome suggestions. Thanks!

    SpockNard
    This is the short version for now.
    Have you given any thought to capturing freeze frames from your video and going from still to video when you want the dancers to animate?
    Not sure if this is the type of thing that you are after but please check out my PE: Perspective Effects blog post
    http://www.atr935.blogspot.com/2013/08/pe-perspective-effects_4.html
    especially the second example demo'ing Bird Flying Out In Picture Frame.
    More later.
    ATR

  • Executing SQL query in portal database

    Hi ,
       I wish to do a simple POC . I need to create a table from NWDS , populate it with some data and then access the table data using an sql query . I am aware how to create a table but I am not sure where exactly to write the query .
    What I would like to understand is
    1) If I create a table where would that table get created (The database) ?
    2) Where would I write that query in NWDS ?
    3) How would I execute that query in that database ?
    Please help for the same .
    (Needless to say that I always award points )
    Regards
    Deepak Singh

    Hi Gopal ,
       Thanks for the reply .This is what I did . I am pasting the whole code of the class that I am using to do the POC .
    package com.gravity;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.util.Hashtable;
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    /*import sun.jdbc.odbc.ee.DataSource;/
    @author Administrator
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class DataHandling {
    public static void DataPost(){
         Connection con = null ;
         try {
    Added code
            Hashtable env = new Hashtable();
              env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
              System.out.println("initial_context_factory put ");
              env.put(javax.naming.Context.PROVIDER_URL, "gms29:50004");
              System.out.println("provide_url put ");
              env.put(javax.naming.Context.SECURITY_PRINCIPAL, "j2ee_admin");
              System.out.println("security_principal put ");
              env.put(javax.naming.Context.SECURITY_CREDENTIALS, "gravity");
              env.put("domain", "true");
              env.put("force_remote", "true");
              System.out.println("security_credentials put ");
              InitialContext iCtxt = new InitialContext(env);
              System.out.println("Object made for initial context ");
              DataSource ds = (DataSource) iCtxt.lookup("jdbc/my_db");
              System.out.println("Datasource obtained ");
              try {
                   con = ds.getConnection();
                   Statement stmt = con.createStatement();
                        String query1 ="insert into EmpData (EMPCODE,EMPNAME) VALUES('naveen',125188)";
                        String query2 ="insert into EmpData (EMPCODE,EMPNAME) VALUES('deepak',125189)";
                        String query3 ="insert into EmpData (EMPCODE,EMPNAME) VALUES('rajeev',125190)";
                   stmt.executeUpdate(query1);
                   stmt.executeUpdate(query2);
                   stmt.executeUpdate(query3);
                  }catch (Exception e) {
                   e.printStackTrace();
             }catch (Exception e) {
                    e.printStackTrace();
                                         } finally {
                                            try {
                                            con.close();
                                                }catch (Exception e) {
                                                e.printStackTrace();
    public static void main (String[] args){
         System.out.println("Hello");
         DataPost();
    I have imported all the driver jar files and sapj2eeclient.jar in the classpath .
    Also the drivers found in the path
    172.16.161.11\usr\sap\EP1\DVEBMGS00\j2ee\cluster\server0\bin\ext\com.sap.portal.jdbcdrivers
    have all been added to the classpath .(Not sure if this is required)
    Let me know what you find wrong in my code and in the meanwhile I will try to implement what you suggested .
    Regards
    Deepak Singh

  • PL/SQL function body returning SQL query - ORA-06502: PL/SQL: numeric or value error

    I'm attempting to dynamically generate a rather large SQL query via the "PL/SQL function body returning SQL query" report region option.  The SQL query generated will possibly be over 32K.  When I execute my page, I sometimes receive the "ORA-06502: PL/SQL: numeric or value error" which points to a larger than 32K query that was generated.  I've seen other posts in the forum related to this dynamic SQL size limitation issue, but they are older (pre-2010) and point to the 32K limit of the DNS (EXECUTE IMMEDIATE) and DBMS_SQL.  I found this post (dynamic sql enhancements in 11g) which discusses 11g no longer having the 32K size limitation for generating dynamic SQL.  Our environment is on 11gR2 and using ApEx 4.2.1.  I do not know which dynamic SQL method -- DNS or DBMS_SQL -- ApEx 4.2.1 is using.  Can someone clarify for me which dynamic SQL method ApEx uses to implement the "PL/SQL function body returning SQL query" option?
    As a test, I created a page on apex.oracle.com with a report region with the following source:
    declare
      l_stub varchar2(25) := 'select * from sys.dual ';
      l_sql  clob := l_stub || 'union all ';
      br     number(3) := 33;
    begin
      while length ( l_sql ) < 34000 loop
        l_sql := l_sql || l_stub || 'union all ';
      end loop;
      l_sql := l_sql || l_stub;
      for i in 1 .. ceil ( length ( l_sql ) / br ) loop
        dbms_output.put_line ( dbms_lob.substr ( l_sql, br, ( ( i - 1 ) * br ) + 1 ) );
      end loop;
      return l_sql;
    end;
    The dbms_output section is there to be able to run this code in SQL*Plus and confirm the size of the SQL is indeed larger than 32K.  When running this in SQL*Plus, the procedure is successful and produces a proper SQL statement which can be executed.  When I put this into the report region on apex.oracle.com, I get the ORA-06502 error.
    I can certainly implement a work-around for my issue by creating a 'Before Header' process on the page which populates an ApEx collection with the data I am returning and then the report can simply select from the collection, but according to documentation, the above 32K limitation should be resolved in 11g.  Thoughts?
    Shane.

    What setting do you use in your report properties - especially in Type and in Region Source?
    If you have Type="SQL Query", then you should have a SELECT statement in the Region Source. Something like: SELECT .... FROM ... WHERE
    According to the ERR-1101 error message, you have probably set Type to "SQL Query (PL/SQL function body returning SQL query)". In this situation APEX expects you to write a body of a PL/SQL function, that will generate the text of a SQL query that APEX should run. So it can be something like:
    declare
    mycond varchar2(4000);
    begin
    if :P1_REPORT_SEARCH is not null THEN
    mycond:='WHERE LAST_NAME like :P1_REPORT_SEARCH ||''%''';
    end if;
    return 'select EMPLOYEE_ID, FIRST_NAME, LAST_NAME from EMPLOYEES ' ||mycond;
    end;
    And for escaping - are you interested in escaping the LIKE wildcards, or the quotes?
    For escaping the wildcards in LIKE function so that when the user enters % you will find a record with % and not all functions, look into the SQL Reference:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm
    (You would than need to change the code of your function accordingly).
    If you are interested in escaping the quotes, try to avoid concatenating the values entered by the user into the SQL. If you can, use bind variables instead - as I have in my example above. If you start concatenating the values into the text of SQL, you are open to SQLInjection - user can enter anything, even things that will break your SQL. If you really need to allow users to choose the operator, I would probably give them a separate combo for operators and a textfield for values, than you could check if the operator is one of the allowed ones and create the condition accordingly - and than still use bind variable for inserting the filtering value into the query.

  • Adding update and delete buttons to a  Report from SQL Query

    There is an option when creating a QBE to add update and delete
    links which i find quite useful, but this option doesn't seem to
    be possible on a Report from SQL Query. Do i need to do
    something special to add them? is the option located in a
    different place?

    Hi,
    You can only add Update ,Delete in QBE Reports,
    there is no option in Portal which can be used to
    have these buttons in the Reports from Query Wizard or
    Report from SQL Query.
    Thanks
    Vineet

  • Create default sql query in DashBoard Prompt

    Hi,
    I want to set the default value in a DashBoard Prompt to current year with a sql query?
    thnx, Robbert

    You need to create a dashboard prompt and in Default To -> select SQL Results
    Click on the ... (three dots ) underneath it and put in your sql
    For Example , I have a Table called "Sales Date" in my "ABC" presentation folder. This has a column called "Year" and "Date". If I want to have a Year prompt with the default value set to current year, here is what the syntax of my sql result will be :-
    SELECT "ABC"."Sales Date".YEAR
    FROM "ABC"
    WHERE "Date" = current_date
    In SQL, we cannot put SQL as we know of in terms of Oracle, Sql Server etc. The SQL here refers to sql as OBIEE understands it and should be in the form of Select "Presentation foler"."Table Name".ColumnName from "Presentation Folder"
    Hope this helps

  • SQL Query to search for most and least popular brands bought by spesific client and total

    Hi to SQL query masters!
    I need to create a report on most and least popular brand names within one specific client orders.
    For example, during last month or a year among 100% of specific client's orders were 70% IBM products, 20% of HP and 10% Lenovo products.
    How do I do that?
    And I also think that it might be useful to have a query that shows top popular brands among all sales in given period of time – this statistic might improve warehouse turnover and marketing activities on least popular brand names.
    I tried to use info from this link, but it didn’t help https://websmp106.sap-ag.de/~form/sapnet?_SCENARIO=01100035870000000183&_FRAME=OBJECT&_HIER_KEY=701100035871000439554&
    Kind regards,
    Ilya.

    Hi
    Please Check this
    SELECT COUNT (T2.[CardCode]) as 'no of sales', T3.ItmsGrpNam,T2.Cardname
    FROM rdr1 T0  INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN ORDR T2 ON T0.DocEntry = T2.DocEntry
    INNER JOIN OITB T3 ON T1.ItmsGrpCod = T3.ItmsGrpCod
    WHERE T2.[DocDate] >= [%0] and  T2.[DocDate] <= [%1]
    GROUP BY T3.ItmsGrpNam,T2.Cardname
    ORDER BY COUNT (T2.[cardcode]) desc

  • Creating a ad-hoc calculation using sql query

    Hi All,
    I want to know if its possible some way to create a ad-hoc sql query inside a workbook so as to create a calculation using that sql.
    I have a folder which gives me balance for any period. My requirement is to display current period balance along with prior years closing balance in same record for each code combination. I dont want to modify folder definition.
    Thanks for your inputs.
    Vishal.

    You could try creating a custom function for this purpose. You would need to register the function in the End User Layer and then you can call the function from your report.

  • LIKE operator is not working in SQL Query in XML file

    Hi Gurus,
    LIKE operator is not working in SQL query in XML template.
    I am creating a PDF report in ADF using Jdeveloper10g. The XML template is as follows
    <?xml version="1.0" encoding="WINDOWS-1252" ?>
    <dataTemplate name="catalogDataTemplate" description="Magazine
    Catalog" defaultPackage="" Version="1.0">
    <parameters>
    <parameter name="id" dataType="number" />
    <parameter name="ename" dataType="character" />
    </parameters>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[
       SELECT ename, empno, job, mgr from EMP where deptno=:id and ename LIKE :ename || '%']]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="EmployeeInfo" source="Q1">
    <element name="EmployeeName" value="ename" />
    <element name="EMPNO" value="empno" />
    <element name="JOB" value="job"/>
    <element name="MANAGER" value="mgr" />
    </group>
    </dataStructure>
    </dataTemplate>
    if i pass the parameter value of :ename from UI, it doesn't filter. But if I give ename = :ename it retrieves the data. Can anyone help me why LIKE operator doesn't work here?
    Appreciate your help,
    Shyamal
    email: [email protected]

    Hi
    Well for a start, you are doing some very strange conversions there. For example...
    and to_char(a.msd, 'MM/DD/YYYY') != '11/11/2030'
    and to_char(a.msd, 'MM/DD/YYYY') != '10/10/2030'If a.msd is a date then you should e converting on the other side ie.
    and a.msd != TO_DATE('11/11/2030', 'MM/DD/YYYY')
    and a.msd != TO_DATE('10/10/2030', 'MM/DD/YYYY')Also, you may want to take into consideration nothing being input in :P2_ITEM_NUMBER like this...
    AND INSTR(a.item_number,NVL(:P2_ITEM_NUMBER,a.item_number)) > 0Is item number actually a number or char field? If it's a number, you want to explicitly convert it to a string for using INSTR like this...
    AND INSTR(TO_CHAR(a.item_number),NVL(TO_CHAR(:P2_ITEM_NUMBER),TO_CHAR(a.item_number))) > 0?
    Cheers
    Ben

  • Column Headings on PL/SQL returning SQL Query report- using br

    Hi,
    I would like to create a report region based upon a function returning a SQL query. As a dem oI have created the following:
    create or replace function xxjk_retsql return varchar2
    as
    begin
    return 'select i "column header" from wwv_flow_dual100';
    end;I want to be able to insert a line break in the column header so it wraps over two lines. I tried this:
    create or replace function xxjk_retsql return varchar2
    as
    begin
    return 'select i "column<br>header" from wwv_flow_dual100';
    end;however when the region is rendered, it appears to strip out the HTML tag. I also tried another tag, <i></i>, as a test and this is stripped out also.
    Is there a way to include a break in a column header in this manner?
    Thank-you,

    There is an option Strip HTML and it is turned on by default. Try changing that to see what happes.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • SQL Query Set

    Hi,
    I am building a LOV in Designer based on one table usage and
    I am adding an SQL Query Set based on another table to create an UNION on those two tables.
    When I generate, I get :
    CDG-03485 ERROR: SQL Query Set TEST.LOV.UNION: Inconsistent item datatypes or wrong number of items in query set
    Where can I find help on how to use SQL Query Set ? Or how can I solve this problem ?
    Thank you,
    Denise

    The problem has been solved...

  • In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String

    In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .

    Hi Srinath,
    The below blog might be useful
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
    PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
    regards,
    Harish

Maybe you are looking for

  • Error when scheduling a cmd file (program object) via the cmc

    Hi, I have added a program object which is a cmd file in the BO repository. When I try to schedule it through the cmc, I'm receiving the following error message: "Could not capture output for the program". The credentials to execute this program obje

  • Outgoing payment   on account pld

    Hello sap experts In an outgoing payment   on account pld   i have one UDT  table which my invoices are tracked in to that now  i want to tract the details of invoice is it possible IN PLD PLS ANSWER ASAP REGARDS JENNY

  • Configuring Security With 11g

    Hi, I have just started with the 11g version and couldn't find the Web service manager component. So how are the security policies to be defined which were earlier handled by the gateway and the agents? Moreover earlier there was the application serv

  • I have two Adobe ID's. Can they be merged?

    I'm not sure how this happened. There's only one of me, but I have two Adobe ID's (linked to two different email addresses). Can they be merged so that I have only one ID and no confusion for me or for Adobe?

  • Unable to set up connection factory for stand-alone resource adapter

    I'm testing out JCA 1.5 in OC4J P4, and I try to register a resource apapter by configuring oc4j-ra.xml like this: <connector-factory location="MySomething" connector-name="Something"> However, I get the following error: 05/09/28 17:14:24 Notificatio