Parameterized Query not working

I need help with my query, I cannot figure out what I seem to be doing wrong.
here is my query
SELECT
CITY, EXAM_DATE, GENDER, ETHNICITY
FROM
APPLICANTS
WHERE CITY = decode(:P1_CITYLOV,'%null%',City,:P1_CITYLOV)
AND EXAM_DATE = decode(:P1_Exam,'%null%',Exam_Date,:P1_Exam)
I want users to select fom drop down menus.
Thanks

1. Please tell us your first name.
2. Tell us what isn't working.
3. Code '%null%' as '%null' || '%' .
Scott

Similar Messages

  • Oracle date parameter query not working?

    http://stackoverflow.com/questions/14539489/oracle-date-parameter-query-not-working
    Trying to run the below query, but always fails even though the parameter values matches. I'm thinking there is a precision issue for :xRowVersion_prev parameter. I want too keep as much precision as possible.
    Delete
    from CONCURRENCYTESTITEMS
    where ITEMID = :xItemId
    and ROWVERSION = :xRowVersion_prev
    The Oracle Rowversion is a TimestampLTZ and so is the oracle parameter type.
    The same code & query works in Sql Server, but not Oracle.
    Public Function CreateConnection() As IDbConnection
    Dim sl As New SettingsLoader
    Dim cs As String = sl.ObtainConnectionString
    Dim cn As OracleConnection = New OracleConnection(cs)
    cn.Open()
    Return cn
    End Function
    Public Function CreateCommand(connection As IDbConnection) As IDbCommand
    Dim cmd As OracleCommand = DirectCast(connection.CreateCommand, OracleCommand)
    cmd.BindByName = True
    Return cmd
    End Function
    <TestMethod()>
    <TestCategory("Oracle")> _
    Public Sub Test_POC_Delete()
    Dim connection As IDbConnection = CreateConnection()
    Dim rowver As DateTime = DateTime.Now
    Dim id As Decimal
    Using cmd As IDbCommand = CreateCommand(connection)
    cmd.CommandText = "insert into CONCURRENCYTESTITEMS values(SEQ_CONCURRENCYTESTITEMS.nextval,'bla bla bla',:xRowVersion) returning ITEMID into :myOutputParameter"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.ReturnValue
    p.DbType = DbType.Decimal
    p.ParameterName = "myOutputParameter"
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion"
    v.Value = rowver
    cmd.Parameters.Add(v)
    cmd.ExecuteNonQuery()
    id = CType(p.Value, Decimal)
    End Using
    Using cmd As IDbCommand = m_DBTypesFactory.CreateCommand(connection)
    cmd.CommandText = " Delete from CONCURRENCYTESTITEMS where ITEMID = :xItemId and ROWVERSION = :xRowVersion_prev"
    Dim p As OracleParameter = New OracleParameter
    p.Direction = ParameterDirection.Input
    p.DbType = DbType.Decimal
    p.ParameterName = "xItemId"
    p.Value = id
    cmd.Parameters.Add(p)
    Dim v As OracleParameter = New OracleParameter
    v.Direction = ParameterDirection.Input
    v.OracleDbType = OracleDbType.TimeStampLTZ
    v.ParameterName = "xRowVersion_prev"
    v.Value = rowver
    v.Precision = 6 '????
    cmd.Parameters.Add(v)
    Dim cnt As Integer = cmd.ExecuteNonQuery()
    If cnt = 0 Then Assert.Fail() 'should delete
    End Using
    connection.Close()
    End Sub
    Schema:
    -- ****** Object: Table SYSTEM.CONCURRENCYTESTITEMS Script Date: 1/26/2013 11:56:50 AM ******
    CREATE TABLE "CONCURRENCYTESTITEMS" (
    "ITEMID" NUMBER(19,0) NOT NULL,
    "NOTES" NCHAR(200) NOT NULL,
    "ROWVERSION" TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL)
    STORAGE (
    NEXT 1048576 )
    Sequence:
    -- ****** Object: Sequence SYSTEM.SEQ_CONCURRENCYTESTITEMS Script Date: 1/26/2013 12:12:48 PM ******
    CREATE SEQUENCE "SEQ_CONCURRENCYTESTITEMS"
    START WITH 1
    CACHE 20
    MAXVALUE 9999999999999999999999999999

    still not comming...
    i have one table each entry is having only one fromdata and one todate only
    i am running below in sql it is showing two rows. ok.
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  '830' and  '850'  and t1.U_frmdate ='20160801'  and  t1.u_todate='20160830'
    in commond promt
      select t1.U_frmdate,t1.U_todate  ,ISNULL(t2.firstName,'')+ ',' +ISNULL(t2.middleName ,'')+','+ISNULL(t2.lastName,'') AS NAME, T2.empID  AS EMPID, T2.U_emp AS Empticket,t2.U_PFAcc,t0.U_pf 
       from  [@PR_PRCSAL1] t0 inner join [@PR_OPRCSAL] t1
       on t0.DocEntry = t1.DocEntry
       inner join ohem t2
       on t2.empID = t0.U_empid  where  t0.U_empid between  {?FromEmid} and  {?ToEmid} and t1.U_frmdate ={?FDate} and  t1.u_todate={?TDate}
    still not showing any results..

  • Cancel Query not working

    Problem Summary
    Cancel Query not working on 11.5.10
    Problem Description
    While finding orders, window pops up the cancel query but when user tries to click the cancel button, query does not cancel.

    jemar98 wrote:
    Problem Summary
    Cancel Query not working on 11.5.10
    Problem Description
    While finding orders, window pops up the cancel query but when user tries to click the cancel button, query does not cancel.Please post the details of the application release, database version and OS.
    Was this working before? If yes, any changes been done recently?
    Please review (Canceling Long Running Queries in Oracle Applications 11i [ID 138159.1]) and make sure you complete all the steps.
    Thanks,
    Hussein

  • Date type parameters do not work package procedure

    a cordial greeting to the whole community, in advance thank you very much for your precious time
    a general way I have the following, a package in which I have a main procedure which I recible three parameters: a start date, a final, and a number of client
    to use the dates I enter as parameter to query yields no records, but if I assign the date internally in the procedure, if it sheds records, the strange thing is that both the data and the parameters that are identical internally assigned even in its length and I checked, the truth and I stay out of ideas thank you very much for your time attaching the code
    for now I'm just using the second query forget the first
    ------call to procedure-----
    DECLARE
    errcode VARCHAR2(200);
    errbuf VARCHAR2(200);
    BEGIN
    xxxxx.pkg.xxxinitial_end(errcode  ,errbuf
                                                        ,'2013/08/19 00:00:00'
                                                        ,'2013/08/23 00:00:00','456456456546');
    END;
    -----------------------------------------------------------------procedure---------------------------------------------------------------------
    PROCEDURExxxinitial_end (ERRCODE OUT VARCHAR2
      , ERRBUFF OUT VARCHAR2
      , p_initial_date IN VARCHAR2
      , p_end_date IN VARCHAR2
      , customer IN VARCHAR2)IS
    l_encoding_line VARCHAR2(240);
    cur_without_customer SYS_REFCURSOR;
    cur_with_customer SYS_REFCURSOR;
      initial_date DATE;
      end_date DATE;
      initial_date2 DATE;
      end_date2 DATE;
    BEGIN
    l_encoding_line := '<?xml version="1.0" encoding=' || '"iso-8859-1"' ||
                       ' ?>' || chr(10) || '<XXOCS_TOTAL_VENTAS_SINEXP>';
      initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');-----------------input parameters  NOT WORKING
      end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');-------------------input parameters
      initial_date2:=to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS');---------------------default values
      end_date2:=to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS');---------------------default values        WORKING FINE
      IF customer IS NULL THEN
       -- OPEN cur_without_customer;
        DBMS_OUTPUT.PUT_LINE('se ejecuto el primero');
        -------------------------cursor  -----------------------------------
        OPEN cur_without_customer FOR
            SELECT rct.customer_trx_id
                  ,rctl.customer_trx_line_id
                  ,hp.party_name ---cliente
                  ,hca.account_number ----N° Cliente
                  ,rctl.line_number -----item
                  ,rctt.name---descripcion transaccion
                  ,rct.trx_number -----numero
                  ,rctt.type ------tipo de transaccion
                  ,hp.party_id--control solamente
                  ,rct.trx_date------Fecha de emisión Comprobante de Venta
                  ,rct.attribute1   ---No. de autorización del Comprobante de Venta
                  ,mp.attribute9||rct.trx_number N_Comprobante---No. de Comprobante de Venta
                  ,rct.attribute4-----Unidad Estratégica de Negocio
                  ,mp.attribute9----  N° de establecimiento
                  ,rctl.description-----Descripción (Tipo de Combustible)
                  ,rctl.quantity_invoiced---Cantidad Vendida en galones
                  ,rctl.unit_selling_price---Precio de venta unitario
                  --,rctl.taxable_amount-------Valor Base Imponible --restriccion
                  --,rctl.extended_amount---valor iva 12%
                 -- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
              FROM ra_customer_trx_all         rct,
                   ra_customer_trx_lines_all   rctl,
                   hz_cust_accounts            hca,
                   hz_parties                  hp,
                   ra_cust_trx_types_all       rctt,
                   mtl_parameters              mp
                  -- mtl_system_items_b          msi,
                 --  zx_lines                    zl
                   --ra_batch_sources_all  rbs
             WHERE
               --rct.trx_date BETWEEN initial_date  AND end_date --parametros de fecha
               rct.trx_date BETWEEN to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*initial_date*/ AND to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*end_date*/
               AND rct.sold_to_customer_id = hca.cust_account_id
               AND hca.party_id = hp.party_id
               AND rct.customer_trx_id=rctl.customer_trx_id
               --AND rctl.inventory_item_id=msi.inventory_item_id
               AND mp.organization_id=rctl.warehouse_id
               AND rct.cust_trx_type_id = rctt.cust_trx_type_id;
         print_output(fnd_file.output, l_encoding_line);
        get_xml(cur_without_customer, 'G_REGISTER', 'CABECERA', ERRCODE);                         
      IF ERRCODE = 1 THEN
        ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
        ERRCODE := 2;
        RETURN;
      ELSIF ERRCODE = 2 THEN
        ERRBUFF := SQLERRM;
        RETURN;
      END IF;
      print_output(fnd_file.output, '</XXOCS_TOTAL_VENTAS_SINEXP>');
         ELSE
         --  OPEN cur_with_customer;
           DBMS_OUTPUT.PUT_LINE('se ejecuto el segundo');
           -----------------------cursor 2---------------------------
           DBMS_OUTPUT.PUT_LINE('customer ' || customer);
           DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS              '||length(p_initial_date));
           DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS              '||length(p_end_date));
           DBMS_OUTPUT.PUT_LINE('customer ' || customer);
           DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS   quemados   '|| length(initial_date2));
           DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS   quemados   '|| length(end_date2));
           DBMS_OUTPUT.PUT_LINE('customer ' || customer);
           DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS convertidso  '|| length(initial_date));
           DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS convertidos  '|| length(end_date));
           OPEN  cur_with_customer FOR
          SELECT     rct.customer_trx_id
                    ,rctl.customer_trx_line_id
                    ,hp.party_name ---cliente
                    ,hca.account_number ----N° Cliente
                    ,rctl.line_number-----item
                    ,rctt.name---descripcion transaccion
                    ,rct.trx_number -----numero
                    ,rctt.type ------tipo de transaccion
                    ,hp.party_id---control solamente
                    ,rct.trx_date------Fecha de emisión Comprobante de Venta
                    ,rct.attribute1   ---No. de autorización del Comprobante de Venta
                    ,mp.attribute9||rct.trx_number N_Comprobante--No. de Comprobante de Venta
                    ,rct.attribute4------ Unidad Estratégica de Negocio
                    ,mp.attribute9---------N° de establecimiento
                    ,rctl.description---------Descripción (Tipo de Combustible)
                    ,rctl.quantity_invoiced----Cantidad Vendida en galones
                    ,rctl.unit_selling_price ---Precio de venta unitario
                   -- ,rctl.taxable_amount-------Valor Base Imponible --restriccion
                   -- ,rctl.extended_amount---valor iva 12%
              -- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
                FROM ra_customer_trx_all           rct,
                     ra_customer_trx_lines_all     rctl,
                     hz_cust_accounts              hca,
                     hz_parties                    hp,
                     ra_cust_trx_types_all         rctt,
                     mtl_parameters                mp
                    -- mtl_system_items_b            msi,
                     --zx_lines                      zl
                 WHERE hca.account_number=customer
                  AND  hca.party_id=hp.party_id
                  AND  hca.cust_account_id=rct.sold_to_customer_id
                  AND  rct.customer_trx_id=rctl.customer_trx_id
                 -- AND  rctl.inventory_item_id=msi.inventory_item_id
                  AND  mp.organization_id=rctl.warehouse_id
                  AND  rct.cust_trx_type_id = rctt.cust_trx_type_id
                  AND rownum = 1
            AND rct.trx_date BETWEEN initial_date AND end_date;<------------when I assign these parameters( initial_date AND end_date  )--are the insert by parameter  initial_date2 AND end_date2 defualt
           DBMS_OUTPUT.PUT_LINE('customer ' || customer);
           DBMS_OUTPUT.PUT_LINE('fe inicial ' || initial_date);
           DBMS_OUTPUT.PUT_LINE('fe final ' ||end_date);
           print_output(fnd_file.output, l_encoding_line);
           get_xml(cur_with_customer, 'G_REGISTER', 'CABECERA', ERRCODE);                         
      IF ERRCODE = 1 THEN
        ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
        ERRCODE := 2;
        RETURN;
      ELSIF ERRCODE = 2 THEN
        ERRBUFF := SQLERRM;
        RETURN;
      END IF;
      print_output(fnd_file.output, '</XXOCS_TOTAL_VENTAS_SINEXP>');
        END IF;
        EXCEPTION
      WHEN OTHERS THEN
        print_output(fnd_file.log, 'Error Ventas sin Exportaciones:' || SQLERRM);
        ERRCODE := 2;
        ERRBUFF := SQLERRM;
      -- Initialization
    END  xxxinitial_end;

    Welcome.  As a note, this question has nothing to do with PL/SQL XML programming and everything to do with SQL and PL/SQL
    That said, the simple test case I setup, because I don't have all your tables, works just fine.
    declare
       l_errcode  VARCHAR2(300);
       l_errbuff  VARCHAR2(300);
       PROCEDURE xxxinitial_end (ERRCODE OUT VARCHAR2
         , ERRBUFF OUT VARCHAR2
         , p_initial_date IN VARCHAR2  -- why not a date?
         , p_end_date IN VARCHAR2      -- why not a date?
         , customer IN VARCHAR2)
       IS
         initial_date DATE;
         end_date DATE;
         l_value  VARCHAR2(10);
       BEGIN
         initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');
         end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');
         -- Not trapping the No Data Found on purpose
         SELECT 'hit'
           INTO l_value
           FROM dual
          WHERE SYSDATE BETWEEN initial_date AND end_date;
       END  xxxinitial_end;
    begin
      -- Test statements here
      xxxinitial_end(l_errcode, l_errbuff
                     ,'2013/08/19 00:00:00'
                     ,'2013/10/19 00:00:00'
                     ,null);
    end;
    As a comment above says, if you are dealing with dates, why not use a DATE parameter in the procedure and avoid the conversion in your code.
    Also, you can simplify your code a bit by using a third sys_refcursor and setting one of the opened cursors to it.  This allows you to pull out the common logic following the OPEN and only have one copy of it.
    PROCEDURE xxxinitial_end (ERRCODE OUT VARCHAR2
      , ERRBUFF OUT VARCHAR2
      , p_initial_date IN VARCHAR2  -- why not a date?
      , p_end_date IN VARCHAR2      -- why not a date?
      , customer IN VARCHAR2)
    IS
      l_encoding_line VARCHAR2(240);
      cur_without_customer SYS_REFCURSOR;
      cur_with_customer SYS_REFCURSOR;
      cur_comm          SYS_REFCURSOR;
      initial_date DATE;
      end_date DATE;
    BEGIN
      l_encoding_line := '<?xml version="1.0" encoding=' || '"iso-8859-1"' ||
                         ' ?>' || chr(10) || '<XXOCS_TOTAL_VENTAS_SINEXP>';
      initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');-----------------input parameters  NOT WORKING
      end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');-------------------input parameters
      IF customer IS NULL THEN
        -------------------------cursor  -----------------------------------
        OPEN cur_without_customer FOR
            SELECT rct.customer_trx_id
                  ,rctl.customer_trx_line_id
                  ,hp.party_name ---cliente
                  ,hca.account_number ----N° Cliente
                  ,rctl.line_number -----item
                  ,rctt.name---descripcion transaccion
                  ,rct.trx_number -----numero
                  ,rctt.type ------tipo de transaccion
                  ,hp.party_id--control solamente
                  ,rct.trx_date------Fecha de emisión Comprobante de Venta
                  ,rct.attribute1   ---No. de autorización del Comprobante de Venta
                  ,mp.attribute9||rct.trx_number N_Comprobante---No. de Comprobante de Venta
                  ,rct.attribute4-----Unidad Estratégica de Negocio
                  ,mp.attribute9----  N° de establecimiento
                  ,rctl.description-----Descripción (Tipo de Combustible)
                  ,rctl.quantity_invoiced---Cantidad Vendida en galones
                  ,rctl.unit_selling_price---Precio de venta unitario
                  --,rctl.taxable_amount-------Valor Base Imponible --restriccion
                  --,rctl.extended_amount---valor iva 12%
                 -- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
              FROM ra_customer_trx_all         rct,
                   ra_customer_trx_lines_all   rctl,
                   hz_cust_accounts            hca,
                   hz_parties                  hp,
                   ra_cust_trx_types_all       rctt,
                   mtl_parameters              mp
                  -- mtl_system_items_b          msi,
                 --  zx_lines                    zl
                   --ra_batch_sources_all  rbs
             WHERE
               --rct.trx_date BETWEEN initial_date  AND end_date --parametros de fecha
               rct.trx_date BETWEEN to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*initial_date*/ AND to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*end_date*/
               AND rct.sold_to_customer_id = hca.cust_account_id
               AND hca.party_id = hp.party_id
               AND rct.customer_trx_id=rctl.customer_trx_id
               --AND rctl.inventory_item_id=msi.inventory_item_id
               AND mp.organization_id=rctl.warehouse_id
               AND rct.cust_trx_type_id = rctt.cust_trx_type_id;
           cur_comm := cur_without_customer;
         ELSE
           -----------------------cursor 2---------------------------
           OPEN  cur_with_customer FOR
          SELECT     rct.customer_trx_id
                    ,rctl.customer_trx_line_id
                    ,hp.party_name ---cliente
                    ,hca.account_number ----N° Cliente
                    ,rctl.line_number-----item
                    ,rctt.name---descripcion transaccion
                    ,rct.trx_number -----numero
                    ,rctt.type ------tipo de transaccion
                    ,hp.party_id---control solamente
                    ,rct.trx_date------Fecha de emisión Comprobante de Venta
                    ,rct.attribute1   ---No. de autorización del Comprobante de Venta
                    ,mp.attribute9||rct.trx_number N_Comprobante--No. de Comprobante de Venta
                    ,rct.attribute4------ Unidad Estratégica de Negocio
                    ,mp.attribute9---------N° de establecimiento
                    ,rctl.description---------Descripción (Tipo de Combustible)
                    ,rctl.quantity_invoiced----Cantidad Vendida en galones
                    ,rctl.unit_selling_price ---Precio de venta unitario
                   -- ,rctl.taxable_amount-------Valor Base Imponible --restriccion
                   -- ,rctl.extended_amount---valor iva 12%
              -- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
                FROM ra_customer_trx_all           rct,
                     ra_customer_trx_lines_all     rctl,
                     hz_cust_accounts              hca,
                     hz_parties                    hp,
                     ra_cust_trx_types_all         rctt,
                     mtl_parameters                mp
                    -- mtl_system_items_b            msi,
                     --zx_lines                      zl
                 WHERE hca.account_number=customer
                  AND  hca.party_id=hp.party_id
                  AND  hca.cust_account_id=rct.sold_to_customer_id
                  AND  rct.customer_trx_id=rctl.customer_trx_id
                 -- AND  rctl.inventory_item_id=msi.inventory_item_id
                  AND  mp.organization_id=rctl.warehouse_id
                  AND  rct.cust_trx_type_id = rctt.cust_trx_type_id
                  AND rownum = 1
            AND rct.trx_date BETWEEN initial_date AND end_date;<------------when I assign these parameters( initial_date AND end_date  )--are the insert by parameter  initial_date2 AND end_date2 defualt
         cur_comm := cur_with_customer;
      END IF;
      print_output(fnd_file.output, l_encoding_line);
      get_xml(cur_comm, 'G_REGISTER', 'CABECERA', ERRCODE);
      CLOSE cur_comm;
      IF ERRCODE = 1 THEN
        ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
        ERRCODE := 2;
        RETURN;
      ELSIF ERRCODE = 2 THEN
        ERRBUFF := SQLERRM;
        RETURN;
      END IF;
    EXCEPTION
      WHEN OTHERS THEN
        print_output(fnd_file.log, 'Error Ventas sin Exportaciones:' || SQLERRM);
        ERRCODE := 2;
        ERRBUFF := SQLERRM;
      -- Initialization
    END  xxxinitial_end;

  • Newbie's ctx_cd query not working

    I've been trying to get a ctx_cd concatenated datastore query to work, but I keep getting weird error messages.
    the code to create the index:
    exec ctx_cd.drop_cdstore('imglib_cd');
    exec ctx_cd.Create_CDstore(cdstore_name =>'imglib_cd', table_name=>'imglib')
    exec ctx_cd.Add_Column('imglib_cd','format','format')
    exec ctx_cd.Add_Column('imglib_cd','keywords','keywords')
    exec ctx_cd.Add_Column('imglib_cd','submitted_by','submitted_by')
    exec ctx_cd.Add_Column('imglib_cd','county','county')
    exec ctx_cd.Add_Column('imglib_cd','facility','facility')
    exec ctx_cd.Add_Column('imglib_cd','project','project')
    exec ctx_cd.Add_Column('imglib_cd','year','year')
    exec ctx_cd.Add_Column('imglib_cd','print_web', 'PRINT_WEB')
    exec ctx_cd.Add_Update_Trigger('imglib_cd','format')
    exec ctx_cd.Add_Update_Trigger('imglib_cd','keywords')
    exec ctx_cd.Add_Update_Trigger('imglib_cd','submitted_by')
    exec ctx_cd.Add_Update_Trigger('imglib_cd','county')
    exec ctx_cd.Add_Update_Trigger('imglib_cd','facility')
    exec ctx_cd.Add_Update_Trigger('imglib_cd','project')
    exec ctx_cd.Add_Update_Trigger('imglib_cd','year')
    exec ctx_cd.Add_Update_Trigger('imglib_cd','print_web')
    exec ctx_ddl.drop_preference(preference_name => 'img_lexer');
    exec ctx_ddl.create_preference(preference_name =>'img_lexer',object_name=>'basic_lexer');
    exec ctx_ddl.set_attribute(preference_name =>'img_lexer',attribute_name=>'index_text',attribute_value=>'true');
    exec ctx_ddl.set_attribute(preference_name=>'img_lexer',attribute_name=>'index_themes',attribute_value =>'false');
    drop index imglibindex;
    select err_text from ctx_user.errors;
    create index imglibindex ON imglib(concat) INDEXTYPE IS ctxsys.context
    PARAMETERS('datastore imglib_cd lexer img_lexer section group imglib_cd');
    the table structure:
    SQL> desc imglib;
    Name Null? Type
    ID NOT NULL NUMBER
    FORMAT VARCHAR2(50)
    DATE_UPLOADED DATE
    PRINT_WEB VARCHAR2(10)
    DPI NUMBER
    MEASUREMENT VARCHAR2(10)
    WIDTH NUMBER
    HEIGHT NUMBER
    KEYWORDS VARCHAR2(1000)
    FILE_SIZE NUMBER
    SUBMITTED_BY VARCHAR2(80)
    URL VARCHAR2(80)
    COUNTY VARCHAR2(50)
    FACILITY VARCHAR2(50)
    PROJECT VARCHAR2(50)
    YEAR VARCHAR2(10)
    CONCAT CHAR(1)
    checking to see if PRINT_WEB exists in User Sections:
    SQL> select sec_name from ctx_user_sections;
    SEC_NAME
    SUBMITTED_BY
    COUNTY
    FACILITY
    PROJECT
    YEAR
    PRINT_WEB
    FORMAT
    KEYWORDS
    8 rows selected.
    the query and the error:
    SQL> SELECT ID, URL, COUNTY, FACILITY, PROJECT, YEAR FROM IMGLIB WHERE CONTAINS(PRINT_WEB,'web withi
    n PRINT_WEB')>0;
    SELECT ID, URL, COUNTY, FACILITY, PROJECT, YEAR FROM IMGLIB WHERE CONTAINS(PRINT_WEB,'web within PRI
    ERROR at line 1:
    ORA-20000: interMedia Text error:
    DRG-10837: section PRINT_WEB does not exist

    I just discovered the problem.
    here's the successful query:
    SELECT ID, URL, COUNTY, FACILITY, PROJECT, YEAR FROM IMGLIB WHERE CONTAINS(CONCAT,'web within PRINT_WEB')>0

  • Inline transform for Sql Query not working in SAP MII 12.1 Version 12.1.8 B

    Hi All,
    I applied an xslt for an sql query which returns an xml file.
    I used inline transform icon in sql query to load an xsl file which has to return me a string
    Any idea why is not working for me..?
    My Sample XML file:
                                     <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="/XMII/CM/BatchDisposition/BatchQueueManagement/StyleSheets/ProductXsl.xsl"?>
    <Rowsets DateCreated="2011-05-05T07:27:45" EndDate="2011-05-05T07:27:45" StartDate="2011-05-05T06:27:45" Version="12.1.8 Build(20)">
         <Rowset>
              <Columns>
                   <Column Description="ProductName" MaxRange="1" MinRange="0" Name="ProductName" SQLDataType="12" SourceColumn="ProductName"/>
              </Columns>
              <Row>
                   <ProductName>Asprin 100mg Tablets 12 x10 strip</ProductName>
              </Row>
              <Row>
                   <ProductName>Asprin 300mg Tablets 12 x10 strip</ProductName>
              </Row>
              <Row><ProductName>Ibprooven 200mg Tablets 12 x 10 strip</ProductName></Row>
              <Row><ProductName>RipTide 50mg Tablets 40 x10 strip</ProductName></Row>
              <Row><ProductName>Seroquel 200mg Tablets 6 x10 strip</ProductName></Row>
              <Row><ProductName>Seroquel 400mg Tablets 12 x10 strip</ProductName></Row>
         </Rowset>
    </Rowsets>
    My Sample XSl File:
                                    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
         <xsl:text>["</xsl:text>
         <xsl:for-each select="Rowsets/Rowset/Row">
              <xsl:value-of select="ProductName"/>
              <xsl:if test="position() &lt; last()">
                   <xsl:text>","</xsl:text>
                    </xsl:if>
              <xsl:if test="position()=last()">
                           <xsl:text>"]</xsl:text>
                    </xsl:if>
         </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Any Suggestions  are Welcome:
    Thanks

    Something like this should work...
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="/">
              <Rowsets DateCreated="{Rowsets/@DateCreated}" Version="{Rowsets/@Version}" StartDate="{Rowsets/@StartDate}" EndDate="{Rowsets/@EndDate}">
                   <xsl:copy-of select="/Rowsets/FatalError"/>
                   <xsl:copy-of select="/Rowsets/Messages"/>
                   <Rowset>
                   <Columns>
                        <Column Description="Mycol1" MaxRange="1" MinRange="0" Name="Mycol1" SQLDataType="12" SourceColumn="Mycol1" />
                   </Columns>
                   <Row>
                   <Mycol1>
                   <xsl:text>["</xsl:text>
                        <xsl:for-each select="/Rowsets/Rowset/Row">
                             <xsl:value-of select="." />
                             <xsl:choose>
                                  <xsl:when test="position() &lt; last()"><xsl:text>","</xsl:text></xsl:when>
                                  <xsl:otherwise><xsl:text>"]</xsl:text></xsl:otherwise>
                             </xsl:choose>
                        </xsl:for-each>
                   </Mycol1>
                   </Row>
                   </Rowset>
              </Rowsets>
         </xsl:template>
    </xsl:stylesheet>

  • BW query not working in portal

    Hello Experts,
    We have this issue when we have a BW query which is running well in RSRT but the query is not working in Portal.
    The error message we have is
    User when running the report is getting the error message “Error in File SMT-0454 - Contribution Analysis (Cx) :   Error in formula  Running Total Condition Formula: 'HierarchyLevel (GroupingLevel ({YPAXXM01_YPAXXM01_QC001.[YGLSUBBRD                     GSK1CXBRNDCATH]-NodeId})) = 1' This field name is not known..”
    Explored the possibilties , Could this be issue with BW query.
    We have this query getting fed to BO's. Please advise.
    Thanks,
    Santhosh

    Hi Santhosh,
    Error... This field name is not known, check your formulas in query, there might be some changes happenened with the characteristics used in formula.
    Check the formula by going up to base level, you might removed some field ex: YGLSUBBRD from your query. Repair it appropriately.
    Hope helps - Kumar

  • Cascading Dynamic Parameters Do Not Work In Crystal Viewer 2008?

    I have generated a report with Crystal Reports 2008 that uses a dynamic cascading parameter. I work in waste management and the report I create in Crystal is used as a "template" with the tonnages collected from all of our customers. Our less technically minded employees can then open this report with Crystal Reports Viewer 2008, use the drop down menus to select only the customer they need a report for and then export this to PDF for delivery.
    The report as designed works perfectly in Crystal Reports, but the parameter does not work in Crystal Viewer.
    Some of our customers have more than one physical location that we service. The cascading dynamic parameter in my report allows you to select the customer name, and then it only shows the locations linked to that customer, so the end user can select only the relevant location(s) for the report. The cascading parameter is dynamic and allows multiple selections, and is linked to a Saved Data formula. The report is saved with the data.
    When the report is opened in Viewer, one of two things happens. If the report is saved in Crystal Reports and a specific customer/location is selected, then ONLY those selected customer/locations are available in the Viewer. If ALL the customers/locations are selected in Crystal Reports and saved, then in the Viewer they are all available, but selecting one customer does NOT narrow down the locations (i.e. it does not "cascade") and instead ALL of the locations are available even if they do not apply to the customer.
    If I use a single dynamic parameter and select ALL of the customers (for example), then when this is opened in Crystal Viewer all of the customers are available from the parameters drop down and the report works fine. As soon as this is tried with a cascading parameter however, Crystal Viewer falls down.
    Does anyone know of a workaround to this or if there is something I am doing wrong?

    I am using the free Crystal Report 2008 Viewer along with designing reports with Crytal Reports ver 12.3. With a test file from SAP called "Interactive Parameters", the parameter feature works to refresh the report. The parameters that are supplied in the sample report work with Viewer. They show up under the parameter list in the parameter side panel in Viewer and are available to make record selections. When I add a parameter to the sample report in Crystal 2008 and then view the report in Viewer, my parameters are unavalable for record selection while the original parameters remain available. Futher, my parameters are displayed under a section called "Current Data Set" in the Parameter side panel, while the selectable parameters are displayed under the "Parameter" section in the parameter side panel. There must be a setting that is treating the parameters I create differently form the parameters created in the original sample report. Any help would be appreciated.

  • Switch from MySQL to MS SQL Server, Query not working

    I'm sure there is a simple setting somewhere for this, but cannot seem to find it and really would appreciate some assistance. Have an application which uses JDBC to connect to a MySQL DB to run the following query without an issue:
    SELECT * FROM users
    This returns the desired results. Changed to connect to MS SQL Server 2000 using the JDBC-ODBC bridge and the same query returns no results. The problem, SQL Server wants this query instead:
    SELECT * FROM [users]
    I don't want to have to change queries depending on the DB, as that is supposed to be one of the advantages of JDBC. Is there a setting in MySQL (or the JDBC driver) to have it work correctly if I pass table names in []? Or is there a setting in MS SQL Server (or in the JDBC, or ODBC) to have it accept queries without the []?
    Or is there a different approach that I'm missing which would avoid this whole problem?
    Thanks,
    Matt

    I suspect your database definitions are different. It has nothing to do with your java code.
    The bracket syntax is used to indicate the more standard quoted identifiers in standard SQL.
    Thus you could do this in oracle and in MS SQL Server...
    SELECT * FROM "users"
    I suspect that the above will work for your MS SQL Server database and will not work for your Oracle database. However if you created the table in oracle and specifically used "users" (with the double quotes around the name) when creating the table then it would work.
    Of course if the database definitions are different it means you must use different SQL for each. Just as if the name of the table was 'other' rather than 'users'.

  • Update query not working in the JDBC sender Communication channel

    Hi,
    We are working on JDBC to File scenario. As per the configuration, XI should pick the data from SQL database every 20 secs and should update the corresponding flag. We are using subquery in the select and update statement as both header and detail tables are involved.
    Now the issue is, select query is working fine but update statement is not working as expected. It is somehow updating some other records rather than doing for the ones selected by the adapter.
    Moreover logSQLstatement is also not working. Hence we are unable to identify the records which are getting updated.
    Please advise.

    Hi Rumi,
    See Question 8. Transaction Handling (Sender) in [SAP Note 831162 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 JDBC Adapter|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=831162].
    8.  Transaction Handling (Sender)
    Q: If I have the following configured in a JDBC Sender:
    Select Query:
    SELECT column FROM TABLENAME WHERE FLAG = "TRUE"
    Update Query:
    UPDATE TABLENAME SET FLAG = "FALSE" WHERE FLAG = "TRUE"
    How do I know that the JDBC adapter will not update newly added rows (rows that were
    added between the time that the SELECT and UPDATE queries were executed) that were
    not read in the initial SELECT query?
    A: The SELECT and the UPDATE are run in the same DB transaction, i.e. both statements
    have the same view on the database.
    Make sure that both statements use the same WHERE clause. An additional
    requirement for the correct operation of this scenario is the configuration of
    an appropriate transaction isolation level on the database
    (i.e., repeatable_read or serializable). You might also consider using a
    "SELECT FOR UPDATE" statement instead of a plain SELECT statement to
    ensure proper locking on the database. "SELECT FOR UPDATE"
    is not supported in MS SQL database. In this case please make use of an
    appropriate transaction isolation level on the database. For more details
    please contact your DB vendors.
    After, see Transaction Handling Issues in [SAP Note 1039779 - JDBC Adapter issues(Escape character,Transaction handling)|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1039779].
    Best Regards.
    Pedro Baroni

  • Oracle 8i - PL/SQL sub query not working in PROC, but works ins SQL

    I have read about certain things not working in 8i and I think this is one of them, but I was wondering if anyone had a work around. In the place of the SELECT SYSDATE FROM DUAL, I have a table look up, where I am going to look up the OCN of the corresponding VENDOR_ID ( a column in the original query ). I am doing it in a decode statement because if the first condition in the decode statement is met, that's it. But if not, it needs to look up the OCN number in this other table. Simple enough, conceptually. I thought of a view but that necessitates a SELECT statement, too. Anyway, here is the code with the appropriate text bolded:
    CREATE OR REPLACE PROCEDURE tstINS_RATE_ROUTE_RECORDS_PROC (GET_CUR_PERIOD IN DATE) IS
         CUR_PERIOD DATE;
         BEGIN
         CUR_PERIOD := GET_CUR_PERIOD;
         Insert into RATE_ROUTE (
           CVBI_KEY
         , VENDOR_ID
         , OCN
         , ST_CD
         , PERIOD
         , MDFY_DT )
         Select
           C.CVBI_KEY
         , C.VENDOR_ID
         <b>, decode( c.send_lca, 'YES', 'XXX', (SELECT SYSDATE FROM DUAL) )</b>
         , decode( c.send_lca, 'YES', 'XX', SUBSTR(C.ZLOC,5,2) )
         , CUR_PERIOD
         , TO_CHAR(SYSDATE)
         FROM
           rpt_ds1_cnt_cat c
         , cogs_resource cr
         , cogs_t1activity ct1
         , rpt_ds1_aloc_zloc_reverse_vw az
         where (C.CVBI_KEY = CR.CVBI_KEY (+)
         and  CR.PERIOD = CUR_PERIOD)
         AND  (C.CVBI_KEY = CT1.CVBI_KEY (+)
         and CT1.PERIOD = CUR_PERIOD)
         and (az.master_route_name=c.aloc||'-'||c.zloc OR az.reversed=c.aloc||'-'||c.zloc)
         END; -- INS_RATE_ROUTE_RECORDS_PROC

    have read about certain things not working in 8i and I think this is one of them,Yes as I said scalar sub-queries were also not recognized within PL/SQL in 8i.
    Re: PLS-00103: Encountered the symbol "SELECT" when expecting one of the fo
    I was wondering if anyone had a work around.Write a function that returns the value. You may incur a performance penalty from a context switch to PL/SQL, but it may be balanced by the decode optimization you are attempting.

  • Query not working while creating Sales Order... Need suggestions

    Dear All,
    My client requirement involves creation of Sales Orders both as standalone as well as based on Quotations, depending on the case. Now there is a UDF created in the Item Master Data called "U_Unit" which should be populated in another UDF (U_BPQty) in the Sales Order and Sales Quotation which can be changed at the transaction level.
    The requirement is if the Sales Order is created based on Quotation, the system should take the value from 'U_BPQty" of "Sales Quotation" and populate in the Sales Order. if the Sales Order is created as stand-alone, it should take the value from U_Unit field of the Item Master Data. I wrote the following query for that purpose and using it as a FMS but its not working.
    Can you suggest me where I am going wrong?
    Declare @Base varchar
    Declare @Item varchar
    Declare @Draw varchar
    Declare @BaseQty varchar
    Set @Base = (Select Case When $[$38.44.0] is Null then 0 when $[$38.44.0] is not Null then $[$38.44.0] end)
    Set @Item = ($[$38.1.0])
    Set @Draw = (SELECT T0.U_BPQty from QUT1 T0 INNER JOIN OQUT T1 ON T0.DocEntry = T1.DocEntry INNER JOIN RDR1 T2 ON T2.BaseRef = T1.DocNum WHERE T0.ItemCode = @Item)
    Set @BaseQty = (SELECT T0.U_Unit from OITM T0 WHERE T0.ItemCode = $[$38.1.0])
    Select Case when (@Base = 0) then @BaseQty when (@Base <> 0) then @Draw end
    Thanks and regards,
    Bharath S

    Hi Bharath.......
    As you said if SQ not there and SO is directly punched then it should Pick up U_Unit else if SQ has target of SO then U_BP then your query working fine.
    But if SQ not there and Del is directly punched instead of SO then it should Pick up U_Unit else if SQ has target of Delivery and not SO then U_BP. Is it?
    In such case its not working?
    If yes then use this query.......
    declare @basedoc as nvarchar
    set @basedoc=$[DLN1.BaseType.0]
    If @basedoc<1
    Begin
    Select T0.U_Unit from OITM T0 Where T0.ItemCode=$[DLN1.ItemCode.0]
    End
    If @basedoc>1
    Begin
    Select T0.U_BPQty From QUT1 T0 where T0.docentry=$[DLN1.BaseEntry.0] and T0.ItemCode=$[DLN1.ItemCode.0]
    End
    Else use this......
    declare @basedoc as nvarchar
    set @basedoc=$[DLN1.BaseType.0]
    If @basedoc<1
    Begin
    Select T0.U_Unit from OITM T0 Where T0.ItemCode=$[DLN1.ItemCode.0]
    End
    If @basedoc>1
    Begin
    Select T0.U_BPQty From RDR1 T0 where T0.docentry=$[$38.45.0] and T0.ItemCode=$[DLN1.ItemCode.0]
    End
    Regards,
    Rahul

  • Pld Query Not Working..

    Dear All,
    Following Query is not working when i Use the condition please guide me...
    SELECT     DocNum, DocDate, Linenum,ItemCode,Dscription,Quantity,Unitmsr,paymentterm,cardName,
                            SUM(AED)  AS AED,SUM(CST) as CST,
                         SUM(BED) AS BED, SUM(eCess) AS eCess, SUM(HSC) AS HSC, SUM(VAT) AS Vat
    FROM         (SELECT     t1.Linenum,t0.DocEntry,t0.DocNum, t0.cardName , t0.DocDate,t1.ItemCode, t1.Dscription, t1.Quantity,t1.Unitmsr,t4.pymntgroup as 'paymentterm',
                                                  ISNULL((CASE WHEN upper(t2.STACode) LIKE 'CUS%' THEN t2.basesum ELSE 0 END), 0) AS 'NetAV',
                                                  ISNULL((CASE WHEN upper(t2.STACode) LIKE 'CUS%' THEN t2.TaxSum ELSE 0 END), 0) AS 'BasicCD',
                                                  ISNULL((CASE WHEN upper(t2.STACode) LIKE 'CST%' THEN t2.TaxSum ELSE 0 END), 0) AS 'CST',
                                                  ISNULL((CASE WHEN upper(t2.STACode) LIKE 'AED%' THEN t2.TaxSum ELSE 0 END), 0) AS 'AED',
    ISNULL((CASE WHEN upper(t2.statype) = - 90 THEN t2.TaxSum ELSE 0 END), 0) AS 'BED', ISNULL((CASE WHEN upper(t2.statype) = - 60 THEN t2.TaxSum ELSE 0 END), 0)
                                                  AS 'eCess', ISNULL((CASE WHEN upper(t2.statype) = - 55 THEN t2.TaxSum ELSE 0 END), 0) AS 'HSC',
                                                  ISNULL((CASE WHEN upper(t2.stacode) LIKE 'Vat%' THEN t2.TaxSum ELSE 0 END), 0) AS 'VAT'
                                                                                    FROM  OINV AS t0 INNER JOIN
                         INV1 AS t1 ON t0.DocEntry = t1.DocEntry INNER JOIN
                   OCTG as t4 on t0.groupnum=t4.groupnum inner join
                                                  OITM AS t3 ON t1.ItemCode = t3.ItemCode INNER JOIN
                                                inv4 AS t2 ON t1.DocEntry = t2.DocEntry AND t1.LineNum = t2.LineNum LEFT OUTER JOIN
                                                  [@BTT_RG23D] AS t6 ON t1.U_FolioNo = t6.Code
                                           ) AS T
                       GROUP BY DocNum,cardName,Linenum, DocDate,Quantity,Dscription,ItemCode,CST,paymentterm,Unitmsr
    Thanks
    Mangesh Pagdhare

    Dear Mangesh Pagdhare,
    You need T. in front of all your main query fields at least.
    Thanks,
    Gordon

  • Select query not working in Dev but working in QA and PRD

    Hi All,
    I have a select query with inner join which is not working in the DEV but working in QA and PRD. Anyone has any idea why is it happening, I think it to be a basis issue. Just want to confirm if anyone has any other idea.
    Thanks in advance,
    Barjinder Singh.

    Hi Barjinder Singh,
    In development you can't find the records for the table.
    In testing system only you can test even the program(report).
    If it is the DEV system you can't get the data.
    Go and see into the table wether it has records or not(in DEV system).
    It doesn't has the records in DEV system.
    Regards,
    Balakrishna.N

  • Query not working fine

    Hi
    db version is 9.2.0.8.0
    in dev the query is working fine.But in qa the query is not working fine(hanging).I had checked the explain plans.
    Both are different.This is due to difference in volume of data.
    I am pasting the explain plans of both the queries in qa and dev
    qa explain plan
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 606M| 118G| | 107M (1)|
    | 1 | SORT GROUP BY | | 606M| 118G| 524G| 107M (1)|
    | 2 | HASH JOIN | | 1869M| 363G| | 50748 (1)|
    | 3 | TABLE ACCESS FULL | DIM_GEOGRAPHY_HIER | 9066 | 318K| | 331 (1)|
    | 4 | HASH JOIN | | 2474K| 408M| 2232K| 50400 (1)|
    | 5 | TABLE ACCESS FULL | DIM_GEOGRAPHY_HIER | 54396 | 1593K| | 330 (1)|
    | 6 | HASH JOIN | | 2474K| 337M| | 31791 (1)|
    | 7 | TABLE ACCESS FULL | DIM_PRODUCT_HIER | 206 | 3296 | | 25 (4)|
    | 8 | HASH JOIN | | 3162K| 382M| | 31745 (1)|
    | 9 | TABLE ACCESS FULL | DIM_PRODUCT_HIER | 3087 | 27783 | | 25 (4)|
    | 10 | HASH JOIN | | 3162K| 355M| 2952K| 31699 (1)|
    | 11 | MERGE JOIN CARTESIAN | | 62930 | 2212K| | 14627 (1)|
    | 12 | INDEX FAST FULL SCAN | SYS_C0013071 | 2923 | | | 4 (25)|
    | 13 | BUFFER SORT | | 22 | 792 | | 14623 (1)|
    | 14 | TABLE ACCESS BY INDEX ROWID| CURCY_CONVERT_RATE | 22 | 792 | | 6 (17)|
    | 15 | INDEX RANGE SCAN | XPKCURRATE | 22 | | | 5 (20)|
    | 16 | TABLE ACCESS FULL | SHIPPABLE_BACKLOG_FACT | 321K| 25M| | 15494 (1)|
    dev explain plan
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 17M| 2978M| | 927K (1)|
    | 1 | SORT GROUP BY | | 17M| 2978M| 6504M| 927K (1)|
    |* 2 | HASH JOIN | | 17M| 2978M| | 2726 (1)|
    |* 3 | TABLE ACCESS FULL | DIM_GEOGRAPHY_HIER | 4992 | 180K| | 416 (1)|
    |* 4 | HASH JOIN | | 41051 | 5852K| 2872K| 2309 (1)|
    | 5 | TABLE ACCESS FULL | DIM_GEOGRAPHY_HIER | 69888 | 2047K| | 415 (1)|
    |* 6 | HASH JOIN | | 41051 | 4650K| | 1504 (1)|
    |* 7 | TABLE ACCESS FULL | DIM_PRODUCT_HIER | 206 | 3296 | | 37 (3)|
    |* 8 | HASH JOIN | | 52460 | 5123K| | 1467 (1)|
    | 9 | TABLE ACCESS FULL | DIM_PRODUCT_HIER | 3087 | 27783 | | 37 (3)|
    |* 10 | HASH JOIN | | 52460 | 4661K| | 1430 (1)|
    |* 11 | TABLE ACCESS FULL | SHIPPABLE_BACKLOG_FACT | 7718 | 414K| | 513 (1)|
    | 12 | MERGE JOIN CARTESIAN | | 48941 | 1720K| | 915 (0)|
    | 13 | INDEX FULL SCAN | SYS_C0060330 | 1827 | | | 7 (15)|
    | 14 | BUFFER SORT | | 27 | 972 | | 913 (0)|
    | 15 | TABLE ACCESS BY INDEX ROWID| CURCY_CONVERT_RATE | 27 | 972 | | 2 (50)|
    |* 16 | INDEX RANGE SCAN | XPKCURRATE | 27 | | | 4 (25)|
    Here is the query
    SELECT 'BACKLOG' AS SUBJECT_AREA, 'CURRENT' AS TIME_RANGE
    ,GEO_ROLLUP.GEOGRAPHY_HIER_KEY
    ,PRODUCT_ROLLUP.PRODUCT_HIER_KEY
    , backlog_FACT.DISTRIBUTION_CH_ID
    , backlog_FACT.SALES_DISTRICT_ID
    , SUM(NVL(backlog_FACT.GC_SCHEDULED_AMT,0) - NVL(backlog_FACT.GC_biilled_AMT,0)) AS billing_backlog_AMT
    , SUM(NVL(backlog_FACT.GC_SCHEDULED_AMT,0)- NVL(backlog_FACT.GC_DELIVERED_AMT,0)) AS delivery_backlog_AMT
    , SUM(NVL(backlog_FACT.GC_SCHEDULED_AMT,0) - NVL(backlog_FACT.GC_REV_REC_AMT,0)) AS rev_rec_backlog_AMT
    , CURCY.VALID_FROM
    FROM fact.shippable_backlog_FACT backlog_FACT
    , DIM.DIM_PRODUCT_HIER PRODUCT
    , DIM.DIM_GEOGRAPHY_HIER GEO
    , DIM.DIM_DATE DT
    , DIM.DIM_PRODUCT_HIER PRODUCT_ROLLUP
    , DIM.DIM_GEOGRAPHY_HIER GEO_ROLLUP
    , DIM.CURCY_CONVERT_RATE CURCY
    WHERE
    PRODUCT.PRODUCT_HIER_KEY = backlog_FACT.GEF_PRODUCT_HIER_KEY
    AND GEO.GEOGRAPHY_HIER_KEY = backlog_FACT.GEF_SHIP_TO_GEO_HIER_KEY
    AND ( backlog_FACT.DELIVERY_COMPLETE_DATE IS NULL
         OR backlog_FACT.BILLING_COMPLETE_DATE IS NULL
         OR backlog_FACT.REV_REC_COMPLETE_DATE IS NULL
    AND PRODUCT.PRODUCT_TYPE = PRODUCT_ROLLUP.PRODUCT_TYPE
    AND PRODUCT_ROLLUP.HIER_LEVEL_NUM = 4
    AND PRODUCT_ROLLUP.CURRENT_RECORD_IND = 'Y'
    AND GEO_ROLLUP.SUB_POLE = GEO.SUB_POLE
    AND GEO_ROLLUP.HIER_LEVEL_NUM = 3
    AND GEO_ROLLUP.CURRENT_RECORD_IND = 'Y'
    AND CURCY.VALID_FROM <= BACKLOG_FACT.ORDER_LINE_CREATE_DATE
    AND CURCY.VALID_TO > BACKLOG_FACT.ORDER_LINE_CREATE_DATE
    AND CURCY.EXCHANGE_TYPE_ID = 'M'
    AND CURCY.TO_CURRENCY_ID = 'USD'
    AND CURCY.FROM_CURRENCY_ID = BACKLOG_FACT.DOCUMENT_CURRENCY_ID
    GROUP BY
    PRODUCT_ROLLUP.PRODUCT_HIER_KEY,
    GEO_ROLLUP.GEOGRAPHY_HIER_KEY,
    backlog_FACT.DISTRIBUTION_CH_ID,
    backlog_FACT.SALES_DISTRICT_ID,
    CURCY.VALID_FROM;
    I analyzed all the tables involved in it.
    can anybody give me suggestion in crating indexes or anything else?
    Thanks
    Veer

    Veer,
    Modify your post and enclose your code and output between \ tags for formatting
    \Your code or output goes here
    \Now, are table stats are upto date on all the table on QA machine? If not, analyze your table and indexes and re-run your query
    Regards
    Edited by: OrionNet on May 7, 2009 3:35 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for