ST04-SQL Request

Hi Friends,
In my production system, I've executed the ST04 transaction, Detailed Analysis Menu....SQL Request....Sorted by Buffer gets... and I checked the SQL statement....and then clicked on display execution plan for SQL statement...
There it shows the following information
SELECT STATEMENT ( Estimated Costs = 17,039 , Estimated #Rows = 0 )
        1 TABLE ACCESS FULL LIPS
          ( Estim. Costs = 17,038 , Estim. #Rows = 1 )
          Estim. CPU-Costs = 885,646,245 Estim. IO-Costs = 16,963
          Filter Predicates
What are the parameters that will indicate that there is an issue with the SQL statement
Regards
Aliila

Hello Aliila,
As indicated below, the statement is expensive as the explain plan goes for full table scan. As LIPS table is one of the line item table, it has to read all the blocks of this table to satisfy the user query. So if there is no WHERE clause in the corresponding ABAP code, then you have to discuss with your ABAP developer to input the selective fields in the WHERE clasue so that appropriate indexes will be choosen in the explain plan. From this i can easily conclude that this statment is expensive because of either of these reasons.
1. Missing Where clause in the ABAP code ( I believe this is coming from Z* program/transaction) or
2. User is not inputting any criteria for selecting this ( Here you to need to train the user).
Back to your question: if you are doing sql cache analysis through ST04 normally you have to find out the statement based on the following criteria.
1. Greater than 5% of  the total buffer gets ( This will cause memory load)
and/or
2. Greater than 2% of the physcial reads ( This cause I/O Load).
you can find that total buffers gets and physical read from ST04 initial screen.
Hope above information will help you.
Yours Sincerely
Dileep

Similar Messages

  • Define an interval in st04 / SQL-Cache

    Hi,
    one of our customers runs their systems with DB2 under solaris. The others work with DB2 z/OS or Oracle.
    In these both platforms there is a functionality to define an interval in the Statement Cache / Cursor Cache. With a 'reset' button i can reset all data to zero. And with the 'since reset' button i get new data only for the time since pushing the 'reset' button.
    I wonder if there is nothing familiar in the DB6 SQL-Cache.
    In the st04 transaction there are some buttons to define such an interval, but it seems they work only on the database snapshot screen for bufferpools, cache etc.
    The SAP status shows a DB2 9.5.4 and ECC 6.0 SP 18.
    Is there something that i have overlooked ?
    regards
    Kay

    Hello Kay,
    The behaviour in recent support pack and db2 release levels is that the sql chace is refreshed once you check the sql cache in dbacockpit/st04.
    The new behaviour whereby the SQL cache data is refreshed upon entering ST04 -> SQL chache is         
    the preferred behaviour. The main reason for the old behaviour where the previously stored SQL cache data was initially displayed until a refresh was requested, was due to very slow SQL cahce retrieval in previous releases.                                                                               
    With newer releases, especially db2 v9, it has become faster to retrieve and so, reached an acceptable speed that the behaviour has been changed to trigger a refresh of the data immediately once ST04-> sql cache is       
    selected.                                 
    With this you can be sure that the sql cache you are seeing is current, whenever you check it via dbacockpit.
    Hope this helps,
    Paul

  • Performance issue on 1 SQL request

    Hi,
    We have a performance problem. We have 2 systems. PRD and QAS (QAS is a copy of PRD as of September 2nd)
    SQL request is identical.
    table structures is identical.
    indexes are identical.
    views are identical
    DB stats have all been recalculated on both systems
    initSID.ora values are almost identical. only memory related parameters (and SID) are different.
    Obviously, data is different
    For you info, view ZBW_VIEW_EKPO fetched its info from tables EIKP, LFA1, EKKO and EKPO.
    Starting on September 15th, a query that used to take 10 minutes started taking over 120 minutes.
    I compared explain plans on both system and they are really different:
    SQL request:
    SELECT
      "MANDT" , "EBELN" , "EBELP" , "SAISO" , "SAISJ" , "AEDAT" , "AUREL" , "LOEKZ" , "INCO2" ,
      "ZZTRANSPORT" , "PRODA" , "ZZPRDHA" , "ZZMEM_DATE" , "KDATE" , "ZZHERKL" , "KNUMV" , "KTOKK"
    FROM
      "ZBW_VIEW_EKPO"
    WHERE
      "MANDT" = :A0#
    Explain plan for PRD:
    SELECT STATEMENT ( Estimated Costs = 300,452 , Estimated #Rows = 0 )
            8 HASH JOIN
              ( Estim. Costs = 300,451 , Estim. #Rows = 4,592,525 )
              Estim. CPU-Costs = 9,619,870,571 Estim. IO-Costs = 299,921
              Access Predicates
                1 TABLE ACCESS FULL EIKP
                  ( Estim. Costs = 353 , Estim. #Rows = 54,830 )
                  Estim. CPU-Costs = 49,504,995 Estim. IO-Costs = 350
                  Filter Predicates
                7 HASH JOIN
                  ( Estim. Costs = 300,072 , Estim. #Rows = 4,592,525 )
                  Estim. CPU-Costs = 9,093,820,218 Estim. IO-Costs = 299,571
                  Access Predicates
                    2 TABLE ACCESS FULL LFA1
                      ( Estim. Costs = 63 , Estim. #Rows = 812 )
                      Estim. CPU-Costs = 7,478,316 Estim. IO-Costs = 63
                      Filter Predicates
                    6 HASH JOIN
                      ( Estim. Costs = 299,983 , Estim. #Rows = 4,592,525 )
                      Estim. CPU-Costs = 8,617,899,244 Estim. IO-Costs = 299,508
                      Access Predicates
                        3 TABLE ACCESS FULL EKKO
                          ( Estim. Costs = 2,209 , Estim. #Rows = 271,200 )
                          Estim. CPU-Costs = 561,938,609 Estim. IO-Costs = 2,178
                          Filter Predicates
                        5 TABLE ACCESS BY INDEX ROWID EKPO
                          ( Estim. Costs = 290,522 , Estim. #Rows = 4,592,525 )
                          Estim. CPU-Costs = 6,913,020,784 Estim. IO-Costs = 290,141
                            4 INDEX SKIP SCAN EKPO~Z02
                              ( Estim. Costs = 5,144 , Estim. #Rows = 4,592,525 )
                              Search Columns: 2
                              Estim. CPU-Costs = 789,224,817 Estim. IO-Costs = 5,101
                             Access Predicates Filter Predicates
    Explain plan for QAS:
    SELECT STATEMENT ( Estimated Costs = 263,249 , Estimated #Rows = 13,842,540 )
            7 HASH JOIN
              ( Estim. Costs = 263,249 , Estim. #Rows = 13,842,540 )
              Estim. CPU-Costs = 59,041,893,935 Estim. IO-Costs = 260,190
              Access Predicates
                1 TABLE ACCESS FULL LFA1
                  ( Estim. Costs = 63 , Estim. #Rows = 812 )
                  Estim. CPU-Costs = 7,478,316 Estim. IO-Costs = 63
                  Filter Predicates
                6 HASH JOIN
                  ( Estim. Costs = 263,113 , Estim. #Rows = 13,842,540 )
                  Estim. CPU-Costs = 57,640,387,953 Estim. IO-Costs = 260,127
                  Access Predicates
                    4 HASH JOIN
                      ( Estim. Costs = 2,127 , Estim. #Rows = 194,660 )
                      Estim. CPU-Costs = 513,706,489 Estim. IO-Costs = 2,100
                      Access Predicates
                        2 TABLE ACCESS FULL EIKP
                          ( Estim. Costs = 351 , Estim. #Rows = 54,830 )
                          Estim. CPU-Costs = 49,504,995 Estim. IO-Costs = 348
                          Filter Predicates
                        3 TABLE ACCESS FULL EKKO
                          ( Estim. Costs = 1,534 , Estim. #Rows = 194,660 )
                          Estim. CPU-Costs = 401,526,622 Estim. IO-Costs = 1,513
                          Filter Predicates
                    5 TABLE ACCESS FULL EKPO
                      ( Estim. Costs = 255,339 , Estim. #Rows = 3,631,800 )
                      Estim. CPU-Costs = 55,204,047,516 Estim. IO-Costs = 252,479
                      Filter Predicates
    One more bit of information, PRD was copied to TST about a month ago and this one is also slow.
    I did almost anything I could think of.

    > DB stats have all been recalculated on both systems
    > initSID.ora values are almost identical. only memory related parameters (and SID) are different.
    > Obviously, data is different
    Ok, so you say: the parameters are different, the data is different and the statistics are different.
    I'm surprised that you still expect the plans to be the same...
    > For you info, view ZBW_VIEW_EKPO fetched its info from tables EIKP, LFA1, EKKO and EKPO.
    We will need to see the view definition !
    > Starting on September 15th, a query that used to take 10 minutes started taking over 120 minutes.
    Oh - Sep. 15th - that explains it ... just kiddin'.
    Ok, so it appears to be obvious that from that day on, the execution plan for the query was changed.
    If you're on Oracle 10g you may look it up again and also recall the CBO stats that had been used back then.
    > I compared explain plans on both system and they are really different:
    >
    > SQL request:
    >
    SELECT
    >   "MANDT" , "EBELN" , "EBELP" , "SAISO" , "SAISJ" , "AEDAT" , "AUREL" , "LOEKZ" , "INCO2" ,
    >   "ZZTRANSPORT" , "PRODA" , "ZZPRDHA" , "ZZMEM_DATE" , "KDATE" , "ZZHERKL" , "KNUMV" , "KTOKK"
    > FROM
    >   "ZBW_VIEW_EKPO"
    > WHERE
    >   "MANDT" = :A0#
    Ok - basically you fetch all rows from this view as MANDT is usually not a selection criteria at all.
    > Explain plan for PRD:

    SELECT STATEMENT ( Estimated Costs = 300,452 , Estimated #Rows = 0 )
    >
    >         8 HASH JOIN
    >           ( Estim. Costs = 300,451 , Estim. #Rows = 4,592,525 )
    >           Estim. CPU-Costs = 9,619,870,571 Estim. IO-Costs = 299,921
    >           Access Predicates
    >
    >             1 TABLE ACCESS FULL EIKP
    >               ( Estim. Costs = 353 , Estim. #Rows = 54,830 )
    >               Estim. CPU-Costs = 49,504,995 Estim. IO-Costs = 350
    >               Filter Predicates
    >             7 HASH JOIN
    >               ( Estim. Costs = 300,072 , Estim. #Rows = 4,592,525 )
    >               Estim. CPU-Costs = 9,093,820,218 Estim. IO-Costs = 299,571
    >               Access Predicates
    >
    >                 2 TABLE ACCESS FULL LFA1
    >                   ( Estim. Costs = 63 , Estim. #Rows = 812 )
    >                   Estim. CPU-Costs = 7,478,316 Estim. IO-Costs = 63
    >                   Filter Predicates
    >                 6 HASH JOIN
    >                   ( Estim. Costs = 299,983 , Estim. #Rows = 4,592,525 )
    >                   Estim. CPU-Costs = 8,617,899,244 Estim. IO-Costs = 299,508
    >                   Access Predicates
    >
    >                     3 TABLE ACCESS FULL EKKO
    >                       ( Estim. Costs = 2,209 , Estim. #Rows = 271,200 )
    >                       Estim. CPU-Costs = 561,938,609 Estim. IO-Costs = 2,178
    >                       Filter Predicates
    >                     5 TABLE ACCESS BY INDEX ROWID EKPO
    >                       ( Estim. Costs = 290,522 , Estim. #Rows = 4,592,525 )
    >                       Estim. CPU-Costs = 6,913,020,784 Estim. IO-Costs = 290,141
    >
    >                         4 INDEX SKIP SCAN EKPO~Z02
    >                           ( Estim. Costs = 5,144 , Estim. #Rows = 4,592,525 )
    >                           Search Columns: 2
    >                           Estim. CPU-Costs = 789,224,817 Estim. IO-Costs = 5,101
    >                          Access Predicates Filter Predicates
    Ok, we've no restriction to the data, so Oracle chooses the access methods it thinks are best for large volumes of data - Full table scans and HASH JOINS. The index skip scan is quite odd - maybe this is due to one of the join conditions.
    > Explain plan for QAS:

    SELECT STATEMENT ( Estimated Costs = 263,249 , Estimated #Rows = 13,842,540 )
    >
    >         7 HASH JOIN
    >           ( Estim. Costs = 263,249 , Estim. #Rows = 13,842,540 )
    >           Estim. CPU-Costs = 59,041,893,935 Estim. IO-Costs = 260,190
    >           Access Predicates
    >
    >             1 TABLE ACCESS FULL LFA1
    >               ( Estim. Costs = 63 , Estim. #Rows = 812 )
    >               Estim. CPU-Costs = 7,478,316 Estim. IO-Costs = 63
    >               Filter Predicates
    >             6 HASH JOIN
    >               ( Estim. Costs = 263,113 , Estim. #Rows = 13,842,540 )
    >               Estim. CPU-Costs = 57,640,387,953 Estim. IO-Costs = 260,127
    >               Access Predicates
    >
    >                 4 HASH JOIN
    >                   ( Estim. Costs = 2,127 , Estim. #Rows = 194,660 )
    >                   Estim. CPU-Costs = 513,706,489 Estim. IO-Costs = 2,100
    >                   Access Predicates
    >
    >                     2 TABLE ACCESS FULL EIKP
    >                       ( Estim. Costs = 351 , Estim. #Rows = 54,830 )
    >                       Estim. CPU-Costs = 49,504,995 Estim. IO-Costs = 348
    >                       Filter Predicates
    >                     3 TABLE ACCESS FULL EKKO
    >                       ( Estim. Costs = 1,534 , Estim. #Rows = 194,660 )
    >                       Estim. CPU-Costs = 401,526,622 Estim. IO-Costs = 1,513
    >                       Filter Predicates
    >
    >                 5 TABLE ACCESS FULL EKPO
    >                   ( Estim. Costs = 255,339 , Estim. #Rows = 3,631,800 )
    >                   Estim. CPU-Costs = 55,204,047,516 Estim. IO-Costs = 252,479
    >                   Filter Predicates
    Ok, we see significantly different table sizes here, but at least this second plan leaves out the superfluous Index Skip Scan.
    How to move on from here?
    1. Check whether you've installed all the current patches. Not all bugs that are in the system are hit all the time, so it may very well be that after new CBO stats were calculated you just begin to hit one of it.
    2. Make sure that all parameter recommendations are implemented on the systems. This is crucial for the CBO.
    3. Provide a description of the Indexes and the view definition.
    The easiest would be: perform an Oracle CBO trace and provide a download link to it.
    regards,
    Lars

  • Unable to view SQL Request in Log files

    Hi Folks,
    I am facing an issue which I am unable to find out the solution to view the physical query generated in log files in Presentation Services.
    Below is the SQL Request generated but I want to view the exact physical query i.e SQL Request which is hitting DB.
    So please guiude me to resolve this issue, I guess it is because of Initialization blocks created which is blocking to view the SQL request.
    -------------------- SQL Request:
    set variable LOGLEVEL = 7;SELECT "- Policy Effective-Start Date"."Start Quarter" saw_0, "- Insurance Policy Facts".Revenue saw_1, "- Insurance Policy Facts"."# Insurance Policies" saw_2, "Insurance Policy".Status saw_3, "Insurance Policy".Type saw_4 FROM "Insurance Policies" WHERE ("Insurance Policy".Type = 'Policy') AND ("- Policy Effective-Start Date"."Start Julian Day Number" BETWEEN VALUEOF(CURRENT_JULIAN_DAY)-365 AND VALUEOF("CURRENT_JULIAN_DAY")) ORDER BY saw_0, saw_3, saw_4
    /* QUERY_SRC_CD='rawSQL' */
    Regards
    Dj

    There is no Enterprise Edition of SSMS. There is SSMS Basic and SSMS Complete. Prior to 2012 sp1, only SSMS Basic were available with Express Edition - but as of 2012 sp1 Expredd also offers SSMS Complete. SSMS Complete is selected bu default when you install
    SSMS (unless you are prior to 2012 sp1 and are using Express, of course).
    However, even SSMS Basic *should* show Agent assuming you have permissions for that. This is hearsay, but from trusted sources. Here is what to do:
    Check what is installed for the machine from where you are running SSMS. You can do that using SQL Server Installation Center - see this blog post: http://sqlblog.com/blogs/tibor_karaszi/archive/2011/02/10/what-does-this-express-edition-look-like-anyhow.aspx
     (towards the end).
    On that machine try both this problematic account as well as an account which is sysadmin. Does the sysadmin account see Agent? If so, you know permissions aren't granted properly. If not, then you know the tool is the problme.
    Also try the problematic account from a machine where you know you see Agent normally. Again, this will help you assess whether the problem is the tool (SSMS) or permissions for the account.
    Tibor Karaszi, SQL Server MVP |
    web | blog

  • How to print sql request result to screen by page?

    Hello,
    I'm a beginer in java developpement. I'm looking for information for :
    I want to print to screen the result of a sql request. but I don't know how many lines will be selected. so I want to cut the result in many pages.
    1)how can I do this?
    2)may I do this in Java? if yes in wich package may I search? and is this take a lot of place in memory?
    3)or may I do this with SQL?
    Thank you for your help

    Hi,
    This is a small code snippet, i believe this is more than enough...
    String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=firstDB)))";
    String username= "test";
    String password = "test";
    String GET_EMPLOYEE_DETAILS = "select name, age from managers";
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection con = DriverManager.getConnection(url, username, password1);
    PreparedStatement pstmt =con.prepareStatement(GET_EMPLOYEE_DETAILS );
    ResultSet rs = pstmt.executeQuery();
    while ( rs.next())
    System.out.println(rs.getString("name") + ":"+ rs.getInt("age") );
    rs.close();
    pstmt.close();
    con.close

  • Invalid month sql request for chart

    Hi,
    i try to refresh a report with a dynamical sql request as following :
    select NULL LINK, status_label LABEL, count(fcr.status_code) as VALUE
    from table
    where table.date > '05/06/2007'
    This query is generated dynamicaly from a date picker.
    My problem is that the chart witch should be refreshed by this query, isn't.
    The following error message come from the ajax query :
    chart Flash Chart error: ORA-20987: APEX - Flash Chart error:  - ORA-20001: Fetch error: ORA-01843: not a valid month
    Something disapoint me: when i execute the query in plSQL i have got my wished results.
    Does someone have any idea about this mistake?

    Hi better,
    Try to give
    where table.date >to_date( '05/06/2007','dd/mm/yyyy');Brgds,
    Mini
    Mark Answers Promptly

  • AD HOC SQL request

    Hi,
    Sorry if this one is a bit silly but how can I create a SQL request such as 'SELECT FIELDA,FIELDB,FIELDC FROM TABLE WHERE FIELDC = 'BLA'' and use the result as an input for an interface?
    JF

    Use ODI for that :)
    Create or reverse the datastore "TABLE" with column FIELDA etc..
    create an interface
    drag and drop your datastore "TABLE' and create the mapping do not forget the filter FIELDC="BLA"

  • Help asked for a sql request - thanks

    Hello,
    I'm not a sql Guru... Who can help for this sql request ?
    First I have this:
    SELECT ADDINFO_ID, INFO, LANGUAGE_FK, ENGLISH_NAME
    FROM V_ADDINFOS
    WHERE LANGUAGE_FK = 'EN' (which is very simple...-)
    But now complicated... I have to add this in the same request:
    select sum(val) as nbrInfo
    from(
    select count(*) val from eccgis where addinfo1_fk = ADDINFO_ID
    union all
    select count(*) val from eccgis where addinfo2_fk = ADDINFO_ID
    union all
    select count(*) val from eccgis where addinfo3_fk = ADDINFO_ID
    union all
    select count(*) val from thirdgis where addinfo1_fk = ADDINFO_ID
    union all
    select count(*) val from thirdgis where addinfo2_fk = ADDINFO_ID
    In other words, for each row of the first select, I need to know how much it is linked in the tables eccgis and thirdgis...
    Hope is is clear... -)
    Thank you very very much,
    Michel

    Hi, Michel,
    Almost anywhere that SQL allows an expression (such as a column name, literal or function call) it also allows a scalar sub-query, a SELECT statement based on any table (or tables) that returns one column and (at most) one row. Like other sub-queries, scalar sub-queries can be corellated to the main query.
    To get the grand total you want on each row of your output:
    SELECT ADDINFO_ID, INFO, LANGUAGE_FK, ENGLISH_NAME
    , (select count(*) from eccgis where addinfo1_fk = ADDINFO_ID)
    + (select count(*) from eccgis where addinfo2_fk = ADDINFO_ID)
    + (select count(*) from eccgis where addinfo3_fk = ADDINFO_ID)
    + (select count(*) from thirdgis where addinfo1_fk = ADDINFO_ID)
    + (select count(*) from thirdgis where addinfo2_fk = ADDINFO_ID)
    AS nrbInfo
    FROM V_ADDINFOS
    WHERE LANGUAGE_FK = 'EN';VERY IMPORTANT: Each sub-query must be in parentheses. You'll get a run-time error if any scalar sub-query returns more than one row. (Returning no rows is okay: the value will be NULL).
    By the way, this looks like a bad table design. If each row in eccgis or thirdgis can be associated with more than one foreign key, they should be kept in a separate table. That's the standard way to handle many-to-many relationships.

  • SQL requests when handling a refresh on a persistent-dirty instance

    I just noticed that Kodo issues two SQL requests when handling a refresh
    on a persistent-dirty instance, the first one getting the JDOLOCKX
    column value.
    For a persistent-clean instance, it makes sense to get the version
    number first and to check if it has been changed. If not, the attribute
    values are not read from the database.
    For a persistent-dirty instance, as the memory state has been changed,
    it has to be reloaded anyway and it seems to me that the first request
    is useless.
    Any confirmation ?
    Thanks.

    Yeah, the version check seems to be extraneous. We'll see what we can do
    about that. Thanks for pointing it out!

  • Regroup a lot of small sql request

    hello
    I'am developping a server in c
    This server connects to a database
    I use oo4o for the connection
    But I have I problem because I have a lot of small request like that
    select cdf_nom
    from cdf_codif, fitty_typeinteraction
    where
         fitty_fit_code_fk_pk like '183'
         and fitty_cdf_type_code_fk_pk = cdf_code_pk
         and cdf_numero_pk like 'IY'
    All works ok but the application is too slow because I have a function in c by request like that
         strcpy(sqls,"select cdf_nom");
         strcat(sqls," from splab_specialite_labo, cdf_codif");
         strcat(sqls," where");
         strcat(sqls," splab_sp_code_fk_pk like '");
         strcat(sqls,idLabo);
         strcat(sqls,"' ");
         strcat(sqls," and splab_cdf_lab_code_fk_pk = cdf_code_pk");
         strcat(sqls," and cdf_numero_pk like '15'");
         /* execute la requete */
         requete.Open(*databb,sqls);
         while (!requete.IsEOF())
              /* balise statutLabo */
              requete.GetFieldValue("cdf_nom", statutLabo,TAILLE_CDF_NOM);
              if (strlen(statutLabo) != 0)
                   bstrValue = AsciiToBSTR(statutLabo);
                   if (!bstrValue)
                        ERROR1("Theriaque : AsciiToBSTR function failed");
                        goto shutdown ;
                   cleanAllString(bstrValue);
                   elementNode = requestDoc->CreateNode(NODE_ELEMENT, V_StatutLabo, rootRequestNode, bstrValue);
                   if (!elementNode)
                        ERROR1("Theriaque : creation of element node failed");
                        goto shutdown ;
                   SAFERELEASE(elementNode);
                   if (bstrValue) SysFreeString(bstrValue);
                   bstrValue = NULL ;
              requete.MoveNext();
    I would like to know how to optimise it but I can't regroup all the small request in a big requestbecause it's to slow
    If it's possible a pl/sql bloc it's will be great

    Usually very large directories suffer from bad access times. If you have a single directory with nearly a million files, you will discover that the time for opening the file is much greater than the time for reading it.
    If you have a directory tree containing the files (say that you have a directory, with 100 subdirectories, each one containing 100 subdirectories, each one containing 100 files) you can open the files much faster.

  • Pb of union sql request

    hi,
    I have to execute this sql equest
    Code:
    SELECT ID, NOM, DEFINITION FROM MOT WHERE NOM like 'crédit %'
    UNION SELECT ID, NOM, DEFINITION FROM MOT WHERE NOM LIKE ' crédit' + '%'
    UNION SELECT ID, NOM, DEFINITION FROM MOT WHERE NOM LIKE '%' +" "+ 'crédit' +" "+ '%';
    but it is not possible because the fields NOM, DEFINITION are text fields and not varchar fields and it is not possible to executethis union clause .
    Could you help me to transform this request to another to execute it?
    It is very urgent, if you could help me it would be very kind from you!
    Best regards.
    Nathalie

    Hello,
    Sorry, I just re-read your post and to do the ordering there's a couple of ways I can think of to do it. I'm sure others can come up with something a little bit neater but this should help along the way:
    create table dt_test_order (col1 varchar2(100));
    insert into dt_test_order values('credit');
    insert into dt_test_order values('credit+something');
    insert into dt_test_order values('credit+something else');
    insert into dt_test_order values('something credit+something');
    insert into dt_test_order values('something credit+something else');
    insert into dt_test_order values('something else credit+something else');
    SELECT
         CASE
              WHEN col1 = 'credit' THEN
                   1
              WHEN col1 LIKE 'credit+%' THEN
                   2
              WHEN col1 LIKE '%credit+%' THEN
                   3          
         END col1_order,
         col1
    FROM
         dt_test_order;
    SELECT
         col1
    FROM
         dt_test_order
    ORDER BY
         CASE
              WHEN col1 = 'credit' THEN
                   1
              WHEN col1 LIKE 'credit+%' THEN
                   2
              WHEN col1 LIKE '%credit+%' THEN
                   3          
         END,
         LENGTH(col1);
    SELECT
         col1
    FROM
         dt_test_order
    ORDER BY
         CASE
              WHEN col1 = 'credit' THEN
                   1
              WHEN col1 LIKE 'credit+%' THEN
                   2
              WHEN col1 LIKE '%credit+%' THEN
                   3          
         END,
         col1;
    SELECT
         col1
    FROM
         dt_test_order
    ORDER BY
         CASE
              WHEN col1 = 'credit' THEN
                   1 + LENGTH(col1)
              WHEN col1 LIKE 'credit+%' THEN
                   2 + LENGTH(col1)
              WHEN col1 LIKE '%credit+%' THEN
                   3 + LENGTH(col1)          
         END;There's a few variations on the same theme.
    HTH
    David

  • Direct SQL Request & Navigation

    Hi,
    I have two reports created in answers using direct SQL. I would like to use navigation between both reports, they both have two columns year & month. Is it possible to use 'is prompted' and value interaction with direct sql reports?

    sliderrules wrote:
    ok thanks. I have created a dashboard prompt with two presentation variables pYear & pMonth.
    Does this need to be specified somewhere in my direct database request sql? Year & Month exists in the SQL but how do I pass the presentation variables?
    ThanksYou can call them in the SQL, here is a sample syntax:
    select
    'VALUEOF(NQ_SESSION.CAT)' session_variable,
    'VALUEOF(rv_test_date_to_char)' repository_variable,
    '@{pv_channel_desc}{Internet}' presentation_variable,
    channel_desc
    from channels
    where channel_desc='@{pv_channel_desc}{Internet}'
    Refer to http://108obiee.blogspot.com/2009/11/variables-in-direct-database-requests.html for more details.

  • Trace PL/SQL request

    Hi,
    I have a PL/SQL concurrent request which is called by the concurrent request each hour..
    I need something which is similar to the trace when we are using DBMS_OUTPUT.PUT_LINE.
    Is there a simple way that allow me to trace the commands executed by this pl/sql ??
    Thanks a lot.

    Hi,
    You can enable trace on any concurrent request by referring to (Note: 296559.1 - FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12) and (Note: 453527.1 - How To Trace a Concurrent Request And Generate TKPROF File).
    Regards,
    Hussein

  • Table are not prefixed with Schema in  SQL request - Unable to get Data

    I began this new thread because I closed the [previous one|Unable to get data (DSN connection); a little bit early, I believed it was OK but no the problem still here.
    First my architecture :
    Oracle 9g
    +500 Reports made under CR developper 8.5 or 9.0
    Report opened in VB .net application, framework 2.0 using CR runtime 8.5 and 9.0
    We want to upgrade CR version to 2008, so modification of reports will be done with CR 2008 Developper, and we want to
    use only CR 2008 runtime.
    The problem :
    Everything works fine in CR Developer, but the same report with the same parameters failed when called inside .net.
    The error is "Unable to get data", the database connection is OK but the queries mades from inside the report are wrong :
    The tables/views in the from statement are not prefixed with the Schema, so Oracle don't find them.
    Example (SQL monitoring done with TOAD)
    Execution of postes.rpt report directly in CR :
    Timestamp: 10:30:03.881
    Successful logon attempt (session tag: 0x6464CB8)
    username: 'APPLI_HUET'; database: 'DEV'
    SELECT ...
    FROM  "COMMUN"."ETAB" "ETAB" INNER JOIN "GESTION_DES_TEMPS"."POSTES" "POSTES"
    ON "ETAB"."N_ETAB"="POSTES"."N_ETAB"
    WHERE  "POSTES"."N_ETAB"=2 ORDER BY "POSTES"."N_POSTE"
    Timestamp: 10:50:29.178
    Logoff (session tag: 0x6464CB8).
    Same report, same authentication but throught .net program :
    Timestamp: 11:01:24.569
    Successful logon attempt (session tag: 0xA93FC38)
    username: 'APPLI_HUET'; database: 'DEV'
    SELECT ...
    FROM   "ETAB" "ETAB" INNER JOIN "POSTES" "POSTES"
    ON "ETAB"."N_ETAB"="POSTES"."N_ETAB" WHERE  "POSTES"."N_ETAB"=2 ORDER
    BY "POSTES"."N_POSTE"
    Runtime error occurred: 942 (ORA-00942: Table ou vue inexistante)
    The .net code :
    Dim _report As New ReportDocument()
    _report.Load("report.rpt", OpenReportMethod.OpenReportByDefault)
    Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
    myConnectionInfo.ServerName = "DSN_file"
    myConnectionInfo.UserID = p_Userid
    myConnectionInfo.Password = p_Password
    ' to see code in this method se my original post
    SetDBLogonForReport(myConnectionInfo, _report)
    SetDBLogonForSubreports(myConnectionInfo, _report)
    Dim frmViewer As New CrystalReportViewer
    frmViewer.CrystalReportViewer1.ReportSource = _report
    frmViewer.Show()
    Any ideas ?

    Thanks for the and sorry but I don't understand.
    I've made a research of Location on this forum the more intersting thread I've found is rpt-files do not function anymore after deploying to a different database, but I still don't understand.
    I take a look at all code sample and I can't found anything.
    You say that .Location need to be set, indeed Location property of CrystalDecisions.CrystalReports.Engine.Table object only contains table name.
    I tried to overrides this value by the fully qualified table name (ie Schema.Table, for example GESTION_DES_TEMPS.POSTES), and it work  BUT it wouldn't be the solution, my code is designed to be generic, I can't have a database to know wich schema add before differents table name.
    Why when we execute the report directly in CR 2008 developper we don't have to redefine the table location ?
    Another test :
    I've made a new report directly in CR 2008 with a DSN, launch it in .net with the same DSN (server) : OK
    Then I launch it in .net with another DSN, it work also.
    Why report done with Crystal 8.5 or 9.0 have this problem ?
    I'me gonna be mad....
    Edited by: Yoann DAVID on Jan 8, 2010 3:32 PM

  • Help in SQL requested

    Hi,
    I have the data like given in the table below :
    Cust     Prod     Week     Handling     TSales     HW
    c1     p1     W1     1     20     20
    c1     p2     W1     0     20     0
    c1     p3     W1     1     20     20
    c2     p1     W1     0     12     0
    c2     p2     W1     1     12     12
    c2     p3     W1     1     12     12
    TSales is actually a customer level data only but it kept in Cust Product level. Now I have do something like :
    select SUM(HW) group by Prod,week => As Numerator
    and
    select SUM(distinct TSales) group by week => As Denorminaotr
    How can I acieve this in a SQL.
    Regards,
    Koushik

    with t as
    select 'c1' cust, 'p1' prod, 'W1' week, 1 handling, 20 Tsales, 20 HW from dual
    union all
    select 'c1', 'p2', 'W1', 0, 20, 0 from dual
    union all
    select 'c1', 'p3', 'W1', 1, 20, 20 from dual
    union all
    select 'c2', 'p1', 'W1', 0, 12, 0 from dual
    union all
    select 'c2', 'p2', 'W1', 1, 12, 12 from dual
    union all
    select 'c2', 'p3', 'W1', 1, 12, 12 from dual
    select prod, week, sum(numerator)/sum(denominator) final_value from
    select
    prod, week, sum(HW) over (partition by prod, week) numerator,sum(distinct TSales) over (partition by week) denominator
    from t
    ) group by prod, week;
    Output:
    "PROD"     "WEEK"     "FINAL_VALUE"
    "p2"     "W1"     "0.375"
    "p1"     "W1"     "0.625"
    "p3"     "W1"     "1"

Maybe you are looking for

  • How can I sync my iPad with iTunes? Only getting "setup" options.

    Im trying to get my iTunes songs on my New iPad. But when I connect it I only get the question if I wanna "set up" or "restore". I have the newest iTunes and its the first time i connect my iPad to my mac. How can i get it to understand that it is al

  • Error while using bapi BAPI_INCOMINGINVOICE_CREATE to post MIRO

    Hi Friends,          Im using bapi BAPI_INCOMINGINVOICE_CREATE to post MIRO.          im passing data to table GLACCOUNTDATA.          Below are the table fields im paasing      INVOICE_DOC_ITEM " '000001' deafault always      GL_ACCOUNT  "Which is c

  • LR 2.5 prints too dark with Snow Leopard

    Hello all, I hope someone can help me. I am going really nuts with my printing. Every print I do at the moment is really dark! It doesn't matter if I turn on / off color management or not. If I use profiles or not. If I export from LR and use the pre

  • Sequence settings for 1080p25 footage?

    Dear all, I'm using Final Cut Pro 7 on a Macbook Pro. I have shot some footage on 1080p25 but there is no East set-up or sequence setting specifically for this in the menu. Can someone tell me which is the best sequence or project setting to edit thi

  • Nokia N8: Unable to download from Ovi Store

    After making the error of trying to install Kaspersky to my N8 and so having to re-format everything to get the phone working again (using #*7370# but not the three fingered salute) almost everything is working ok except Ovi Store. I can get onto the