I am struck up with the sql query pleas help me

Hi,
i am struck up with this query
select cpuid,hostid,timestamp from
system_Cpu
where hostid='dscp02469' AND cpuid='second'
CPUID HOSTID TIMESTAMP
second dscp02469 29:jun:2006:18:30:18
second dscp02469 29:jun:2006:18:31:04
second dscp02469 29:jun:2006:18:32:53
second dscp02469 29:jun:2006:18:40:39
second dscp02469 29:jun:2006:18:41:26
second dscp02469 29:jun:2006:18:42:31 (top entry)
i have to get top five minutes records
CPUID HOSTID TIMESTAMP
second dscp02469 29:jun:2006:18:40:39
second dscp02469 29:jun:2006:18:41:26
second dscp02469 29:jun:2006:18:42:31
i am writing this query
select cpuid,hostid,timestamp from system_Cpu where hostid='dscp02469' AND cpuid='second' having max(timestamp)-timestamp<5/1440
having max(timestamp)-timestamp<5/1440
ERROR at line 2:
ORA-00979: not a GROUP BY expression
Message was edited by:
user517983

You seem to be offended...
Well, here is what I tried out (and then posted)...
SQL> select cpuid,hostid,to_char(timestamp, 'dd/mon/yyyy hh24:mi:ss') FROM(select cpuid,hostid,times
tamp, max(timestamp) over () maxts from system_Cpu where hostid='dscp02469' AND cpuid='second' )WHER
E maxts-timestamp<5/1440 ;
CPUID  HOSTID    TO_CHAR(TIMESTAMP,'D
second dscp02469 29/jun/2006 18:40:39
second dscp02469 29/jun/2006 18:41:26
second dscp02469 29/jun/2006 18:42:31And just to display time component, I modified it a bit...
SQL> select cpuid,hostid,to_char(timestamp, 'dd/mon/yyyy hh24:mi:ss') FROM(select cpuid,hostid,times
tamp, max(timestamp) over () maxts from system_Cpu where hostid='dscp02469' AND cpuid='second' )WHER
E maxts-timestamp<5/1440 ;
CPUID  HOSTID    TO_CHAR(TIMESTAMP,'D
second dscp02469 29/jun/2006 18:40:39
second dscp02469 29/jun/2006 18:41:26
second dscp02469 29/jun/2006 18:42:31It worked for me. BTW, the way I interpreted the OP's requirement was-give all records that are within 5 minutes interval from the top (or max) timestamp.
I may be wrong...

Similar Messages

  • Whats wrong with the sql query-- giving no rows selected

    i have a table audit_data with 4 columns , eff_m & end_m are declared as timestamp and the time stamp data is different for all the records
    Please advice as soon as possible as this is a production problem
    ORG_GRP_I grn_n ED_EFF_m (timestamp) ED_END_M OFV
    1 999 01-Jan-06 1 03-Aug-06 0 0
    1 999 28-Jul-06 0 04-Aug-06 1 0
    1 999 04-Aug-06 1 04-Aug-06 1 0
    1 999 04-Aug-06 0 6.08
    This query is giving no rows returned,even though there is data in database
    SELECT NVL(OFV,0)
    FROM audit_data ag
    WHERE ag.ORG_GRP_I = 1
    AND ag.GRN_N = 999
    AND (ag.ED_EFF_M,NVL(ag.ED_END_M,SYSDATE)) IN (SELECT MAX(ED_EFF_M),MAX(NVL(ED_END_M,SYSDATE))
    FROM audit_data ag2
    WHERE ag2.ORG_GRP_I= ag.org_grp_i
    AND ag2.grn_n=ag.grn_n
    AND To_Date(To_Char(ag2.ED_EFF_M,'MM/DD/YYYY'),'MM/DD/YYYY') <= TO_DATE(TO_CHAR('08/04/06','MM/DD/YYYY'),'MM/DD/YYYY')
    AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE(TO_CHAR('08/04/06','MM/DD/YYYY'),'MM/DD/YYYY'));
    This query is giving value 6.08, when made type conversions.
    what wrong with the above query.please advice
    SELECT NVL(OFV,0)
    FROM audit_data ag
    WHERE ag.ORG_GRP_I = 1
    AND ag.GRN_n = 999
    AND (to_date(to_char(ag.ED_EFF_M,'mm/dd/yyyy'),'mm/dd/yyyy'),NVL(to_date(to_char(ag.ED_END_M,'mm/dd/yyyy'),'mm/dd/yyyy'),SYSDATE)) IN
    (SELECT MAX(to_date(to_char(ED_EFF_M,'mm/dd/yyyy'),'mm/dd/yyyy')),MAX(NVL(ED_END_M,SYSDATE))
    FROM audit_data ag2
    WHERE ag2.ORG_GRP_I= ag.org_grp_i
    AND ag2.grn_n=ag.grn_n
    AND To_Date(To_Char(ag2.ED_EFF_M,'MM/DD/YYYY'),'MM/DD/YYYY') <= TO_date('08/04/2006','MM/DD/YYYY')
    AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE('08/04/2006','MM/DD/YYYY'));

    In the second query you convert a string to a date correctly using TO_DATE(string,date format)
    In the first query you try to make a char of something that already is a char, e.g. TO_CHAR('08/04/06','MM/DD/YYYY').
    The TO_CHAR functions expects either a number or a date as its first parameter. That's why it's giving you a ORA-01722.

  • Help with the SQL Query: How to use case.

    Q:- I have written a query which will written the following output.
    C1 C2 C3
    a ---- b.1 ---- 1
    a ---- b.1 ---- 1
    a ---- b.1 ---- 2
    a ---- b.1 ---- 3
    a ---- b.1 ---- 3
    a ---- b.2 ---- 1
    a ---- b.2 ---- 2
    a ---- b.2 ---- 2
    a ---- b.3 ---- 1
    ac---- b.1 ---- 1
    ac---- b.1 ---- 2
    ac---- b.2 ---- 1
    ac---- b.2 ---- 2
    ac---- b.2 ---- 3
    ac---- b.2 ---- 3
    ac---- b ---- 1
    But i want the output to print in the following way. Please suggest.
    C1 C2 C3
    a ---- b.1 ---- 1
    ------------------2
    ------------------3
    a ---- b.2 ---- 1
    ------------------2
    a ---- b.3 ---- 1
    ac---- b.1 ---- 1
    ------------------2
    ac---- b.2 ---- 1
    ------------------2
    ac---- b.2 ---- 3
    ac---- b ---- 1
    Edited by: user555994 on Jan 18, 2011 1:42 AM
    Edited by: user555994 on Jan 18, 2011 1:43 AM

    Or may be
    SQL> ed
    Wrote file afiedt.buf
      1  WITH sample_data AS
      2    (SELECT 'a' C1,'b.1' C2, 1 C3 FROM dual UNION ALL
      3     SELECT 'a' C1,'b.1' C2, 1 C3 FROM dual UNION ALL
      4     SELECT 'a' C1,'b.1' C2, 2 C3 FROM dual UNION ALL
      5     SELECT 'a' C1,'b.1' C2, 3 C3 FROM dual UNION ALL
      6     SELECT 'a' C1,'b.1' C2, 3 C3 FROM dual UNION ALL
      7     SELECT 'a' C1,'b.2' C2, 1 C3 FROM dual UNION ALL
      8     SELECT 'a' C1,'b.2' C2, 2 C3 FROM dual UNION ALL
      9     SELECT 'a' C1,'b.2' C2, 2 C3 FROM dual UNION ALL
    10     SELECT 'a' C1,'b.3' C2, 1 C3 FROM dual UNION ALL
    11     SELECT 'ac' C1,'b.1' C2, 1 C3 FROM dual UNION ALL
    12     SELECT 'ac' C1,'b.1' C2, 2 C3 FROM dual UNION ALL
    13     SELECT 'ac' C1,'b.2' C2, 1 C3 FROM dual UNION ALL
    14     SELECT 'ac' C1,'b.2' C2, 2 C3 FROM dual UNION ALL
    15     SELECT 'ac' C1,'b.2' C2, 3 C3 FROM dual UNION ALL
    16     SELECT 'ac' C1,'b.2' C2, 3 C3 FROM dual UNION ALL
    17     SELECT 'ac' C1,'b' C2, 1 C3 FROM dual
    18     )
    19  SELECT
    20         NVL2(LAG(C1) OVER (PARTITION BY C1,C2 ORDER BY C1,C2,C3),NULL,C1) C1
    21        ,NVL2(LAG(C2) OVER (PARTITION BY C1,C2 ORDER BY C1,C2,C3),NULL,C2) C2
    22        ,C3
    23* FROM (SELECT DISTINCT c1,c2,c3 FROM sample_data)
    SQL> /
    C1 C2          C3
    a  b.1          1
                    2
                    3
    a  b.2          1
                    2
    a  b.3          1
    ac b            1
    ac b.1          1
                    2
    ac b.2          1
                    2
    C1 C2          C3
                    3
    12 rows selected.
    SQL>

  • Whats wrong with the sql query insert .... plz tell me

    {
    String sql = "INSERT INTO candidate VALUES (";
    sql += candidate.getEnrollmentNumber() + ",";
    sql += candidate.getDateOfEnrollment() + ",";
    sql += candidate.getName() + ",";
    sql += candidate.getContactNumber() + ",";
    sql += candidate.getGender() + ",";
    sql += candidate.getMailingAddress() + ",";
    sql += candidate.getEmailId() +",";
    sql += candidate.getClassOfVehicle() + ",";
    sql += candidate.getTypeOfVehicle() + ",";
    sql += candidate.getDateOfBirth() + ",";
    sql += candidate.getBatchTime() +")";
    System.out.println("sql: " +sql);
    //executeQuery(sql);
    executeUpdate(sql);
    }catch(SQLException e){
    e.printStackTrace();
    Giving me error as " com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax;

    If you are inserting a string into your sql, you need to put it in single quotes (but not numbers).
    Example:
    sql += " ' "+candidate.getFirstName() " ', "
    Additionally, if firstName contains a single quote, it needs to be escaped by converting it to two single quotes.
    Note you don't have to do any of this if you use preparedStatements.
    Note: remove both spaces in " ' " so you get "'" in the above example, otherwise you are inserting spaces into your value.
    I use " ' " so you can more easily see what I did..

  • Problem with the SQL Query

    Hey all,
    I made a view so that I could join three databases together and put the results on the association table. However, I keep getting an error that I'm not using the SELECT keyword, when I am. Maybe there is another bug somewhere else?
    CREATE OR REPLACE VIEW "SUPPLIER_COMPETENCY_VW" ("SUPPLIER_PK", "COMPETENCY_PK", "ROW_CREATE_EMAIL", "ROW_CREATE_TIMESTAMP", "ROW_UPDATE_EMAIL", "ROW_UPDATE_TIMESTAMP") AS
    SELECT
    SUPPLIER_COMPETENCY_VW.SUPPLIER_PK||'|'||SUPPLIER_COMPETENCY_VW.COMPETENCY_PK,
    SUPPLIER_COMPETENCY_VW.SUPPLIER_PK,
    SUPPLIER_COMPETENCY_VW.COMPETENCY_PK,
    SUPPLIER_COMPETENCY_VW.ROW_CREATE_EMAIL,
    SUPPLIER_COMPETENCY_VW.ROW_CREATE_TIMESTAMP,
    SUPPLIER_COMPETENCY_VW.ROW_UPDATE_EMAIL,
    SUPPLIER_COMPETENCY_VW.ROW_UPDATE_TIMESTAMP
    FROM
    SUPPLIER_COMPETENCY_TB, TPL_SUPPLIERS_TB, TPL_CONTACTS_TB
    WHERE
    TBL_SUPPLIER_TB.SUPPLIER_PK = SUPPLIER_COMPETENCY_TB.SUPPLIER_PK
    AND
    TBL_COMPETENCY_TB.COMPETENCY_PK = SUPPLIER_COMPETENCY_TB.SUPPLIER_PK
    Any Suggestions?
    Sumer

    CREATE VIEW "SUPPLIER_COMPETENCY_VW" ("SUPPLIER_PK", "COMPETENCY_PK", "ROW_CREATE_EMAIL", "ROW_CREATE_TIMESTAMP", "ROW_UPDATE_EMAIL", "ROW_UPDATE_TIMESTAMP") AS
    SELECT
    SUPPLIER_COMPETENCY_TB.SUPPLIER_PK||'|'||SUPPLIER_COMPETENCY_TB.COMPETENCY_PK,
    SUPPLIER_COMPETENCY_TB.SUPPLIER_PK,
    SUPPLIER_COMPETENCY_TB.COMPETENCY_PK,
    SUPPLIER_COMPETENCY_TB.ROW_CREATE_EMAIL,
    SUPPLIER_COMPETENCY_TB.ROW_CREATE_TIMESTAMP,
    SUPPLIER_COMPETENCY_TB.ROW_UPDATE_EMAIL,
    SUPPLIER_COMPETENCY_TB.ROW_UPDATE_TIMESTAMP
    FROM
    SUPPLIER_COMPETENCY_TB
    The same error keeps coming up of being unable to find the SELECT keyword, yet im not sure where the error is.
    Sumer

  • What's wrong with this sql query?  Help

    hi
    i am having difficulty executing this query
    ResultSet s=st.executeQuery("select * from employee where iden = ?"+id);
    here in my program st is statement obg
    iden is attribute name in table
    id i am getting at run time from user
    please help...it says wrong number of parameters
    thank you

    That's correct, get rid of the Question mark. Questions marks are used in PreparedStatements, but they are also used in pattern matching. I am assuming the iden is the table identity. Therefore, I am assuming it is numeric. If so, you can't use the question mark because pattern matching is only done with strings. If you are treating your statement as a PreparedStatement, then you have done it wrong. (See the API) Here is a code snippet from the API:PreparedStatement pstmt =     
       con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?");
    pstmt.setBigDecimal(1, 153833.00)
    pstmt.setInt(2, 110592)It seems you are using a Statement object, so, you need to get rid of that question mark.
    tajenkins

  • Cluster bar chart- sql query please help-

    Hi,
    I am trying to create cluster bar chart and am stumped with this sql query.Any help is appreciated.
    Here is my table
    city     region      issue     value
    c1     north     i1     y
    c1     north     i2     y
    c2     north     i1     n
    c2     north     i2     y
    c3     south     i1     y
    c3     south     i2     n
    c4     east     i1     n
    c4     east     i2     n
    The bar chart will have 3 series, north south and east.
    And labels will be i1 and i2. value will be number of times this issue was encountered(y) in this region.
    How can I get something like this from the above table-
    region     issue     count(yes)
    north     i1     1
    north     i2     2
    south     i1     1
    south     i2     0
    east     i1     0
    east     i2     0
    thanks

    WITH table1 AS
    (SELECT 1435177 qte_id, 2 seq_no
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 5 seq_no
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 7 seq_no
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 8 seq_no
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 12 seq_no
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 14 seq_no
    FROM dual
    table2 AS
    SELECT 1435177 qte_id, 1 seq_no, 98500 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 2 seq_no, 98500 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 3 seq_no, 0 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 4 seq_no, 98500 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 5 seq_no, 98500 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 7 seq_no, 98500 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 8 seq_no, 98500 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 11 seq_no, 59300 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 12 seq_no, 59300 cmmt_curr_amt
    FROM dual
    UNION ALL
    SELECT 1435177 qte_id, 14 seq_no, 59300 cmmt_curr_amt
    FROM dual
    SELECT qte_id, t2_seq_no, cmmt_curr_amt - cmmt_curr_lag diff
    FROM
    (SELECT t2.qte_id, t2.seq_no t2_seq_no, t1.seq_no t1_seq_no, cmmt_curr_amt, LAG(cmmt_curr_amt,1,0) OVER (PARTITION BY t2.qte_id ORDER BY t2.seq_no) cmmt_curr_lag
    FROM table1 t1, table2 t2
    WHERE t2.qte_id = t1.qte_id (+)
    AND t2.seq_no = t1.seq_no(+)
    ORDER BY 1,2
    WHERE t1_seq_no IS NOT NULL
    ORDER BY 1,2
    QTE_ID T2_SEQ_NO DIFF
    1435177 2 0
    1435177 5 0
    1435177 7 0
    1435177 8 0
    1435177 12 0
    1435177 14 0

  • Help with an SQL Query on the Logger

    We are running UCCE 8.5(3) and need help with an SQL query. When I run the below I would also like to see skill group information(name preferably)? Any help would be greatly appreciated!
    select * from dbo.t_Termination_Call_Detail where DateTime between '10-11-2012 00:00:00:00' and
    '10-11-2012 23:59:59:59'

    David, thanks for replying.  Unfortunitly I don't know enough about SQL to put that into a query and have it return data.  Would you be able to give an example on what the query would look like?

  • How to view the sql query?

    hi,
      how to view the sql query formed from the xml structure in the receiver jdbc?

    You can view SAP Note at
    http://service.sap.com/notes
    But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
    Reason and Prerequisites
    You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
    Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
    Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
    When you want to use a parameter documented here, please be aware to which category it belongs!
    Solution
    The following list shows all available parameters of category 1 or 2. Please note:
    Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
    Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
    The default value of a parameter is always chosen that it does not change the standard functionality
    JDBC Receiver Adapter Parameters
    1. Parameter name: "logSQLStatement"
                  Parameter type: boolean
                  Parameter value: true for any string value, false only for empty string
                  Parameter value default: false (empty String)
                  Available with: SP9
                  Category: 2
                  Description:
                  When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
                  This should be used only during the test phase and not in productive scenarios.
    Regards,
    Prateek

  • How to get cm:search to use the max attribute when creating the SQL query?

    When we use the max attribute in the cm:search tag, it does not seem to honor the max attribute when creating the SQL query. However, the result returned from the tag is limited to the number specified by the max attribute. Then the tag seems to work as intended, but the performance will be sub optimal when the SQL query returns unnecessary rows to the application.
    We use the cm:search tag to list the latest news (ordered by date), and with the current implementation we have to expect a decrease in performance over time as more news is published. But we can’t live with that. We need to do the constraint in the SQL query, not in the application.
    The sortBy attribute of cm:search is translated to “order by” in the SQL query, as expected.
    Is it possible to get cm:search to generate the SQL query with an addition of “where rownum <= maxRows”?

    Hi Erik,
    The behavior of a repository in regards to the search tag's max results parameter is dependent on the underlying repository's implementation. That said, the OOTB repository in WLP does augment the generated SQL to limit the number of rows returned from the database. This is done in the parsing logic. This behavior may differ with other repository implementations.
    -Ryan

  • 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

  • Find out the sql query for special characters.

    Hi,
    I have the emp table with column name first_name.In that table i have lot records with first_name inlcudes the below mentioned special characters.
    ¡ , ¿, ,Ä,Å,ä,ª,À,Á,Ã,à,á,ã,å,Æ,æ,Ç,ç,È,É,Ê,Ë,è,é,ê,ë,Ì,Í,Î, Ï,ì,í,î,ï, Ñ,ñ, ô, º, Ò, Ó, Ô, Õ, Ö, Ø, ò, ó, õ, ö, ø, ß, Û, Ù, Ú, Ü,ù, ú, û, ü, ÿ,
    I am looking for the records with includes the above mentioned special characters in the first_name column.
    Can u please give the sql query to find out the records.
    Thanks&Regards
    N.Sivaraman

    I am looking for the records with includes the above mentioned special characters in the first_name column.One way would be:
    select emp.*
      from emp,
           table (
             sys.odcivarchar2list ('¡',
                                   'Ä',
                                   'Å',
                                   'ä',
                                   'ª',
                                   'À',
                                   'Á',
                                   'Ã',
                                   'à',
                                   'á',
                                   'ã',
                                   'å',
                                   'Æ',
                                   'æ',
                                   'Ç',
                                   'ç',
                                   'È',
                                   'É',
                                   'Ê',
                                   'Ë',
                                   'è',
                                   'é',
                                   'ê',
                                   'ë',
                                   'Ì',
                                   'Í',
                                   'Î',
                                   'Ï',
                                   'ì',
                                   'í',
                                   'î',
                                   'ï',
                                   'Ñ',
                                   'ñ',
                                   'ô',
                                   'º',
                                   'Ò',
                                   'Ó',
                                   'Ô',
                                   'Õ',
                                   'Ö',
                                   'Ø',
                                   'ò',
                                   'ó',
                                   'õ',
                                   'ö',
                                   'ø',
                                   'ß',
                                   'Û',
                                   'Ù',
                                   'Ú',
                                   'Ü',
                                   'ù',
                                   'ú',
                                   'û',
                                   'ü',
                                   'ÿ'
    where instr (ename, column_value) > 0

  • The SQL query is not executing

    Hi
    I have the following situation: In a project we designed our reports calling a stored procedure the exits in a MS SQL Server 200 database. The Stored Procedures works fine and when they are used in the report everything works perfectly.
    The reports are being made with CR DEsigner 11, when the designer ends them, ha pass them to me and we put them in our java web application. I open them and even preview them since the Crystal Reprots Perspective of Eclipse and I can see the data, so everything to this point is OK.
    The problem comes when I change of connection, I'm trying to connect every report to the same host and database, and when the reprot is displayed in the browser there is no data. I profile the SQL commands that are executed when the report is requested and I found that the reprot is not executing the stored procedure.
    I guess because i'm connectring the report to the same database and host that was used when the report is created and i'm also passing exactly the same parameters of the stored procedure, then report thinks that it doesn't have executing again becuase it will be the same information.
    SO, i wonder if there is a way to request to the report to execute the sql query every time i have to display it.
    thanks for any help.

    What happens when you try to view the report using a simple viewer.jsp?without changing the connection?
    2009-05-25 14:06:09,250 ERROR com.businessobjects.reports.sdk.JRCCommunicationAdapter -  detected an exception: Error de conexión: [SQLServer 2000 Driver for JDBC]Error establishing socket.
    But the database server is ok, so i think the rpt needs more information to be connect to the database.
    Also what happens if you dont use the data bean and give everything there only?
    The same, the rpt is not executing the stored procedure.
    Did anything change on the RDBMS side? Additional packages, changes to the schema, ownership, etc?
    No, the server is ok and the database is ok.
    If you configure Log4J logging to DEBUG, you should see the database invokes from the Crystal Java engine, specifically the queries sent and the number of rowsets returned. Do you notice any errors?
    I have a problem here with log4j. In my project i'm using spring and with the help of spring i configure log4j, basically with spring is easier to configure log4j.
    I'm telling you this because i have log4j working but when my application reaches the code to change the connection to the rerport, log4j dies and stop sending any message to the stdout or to a log file. I haven't since this behavior in any other app o library. So i want to guess i have something wrong with my log4j or maybe with log4j+spring.
    So, i remove all the code of spring referring to log4j, but the problem with log4j wasn't solved.
    What i will try now is to remove spring from the project.
    This is my log4j.properties:
    log4j.rootLogger=DEBUG, stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n

  • Condition Concatination with the SQL String

    Hi Friends,
    I am facing problem in concatinating the below sring
    [  ','||:id1||',' like '%,'''||hou.name||''',%' ] in the below query in the place of [ hou.name =:id1 ]
    My Query :
    Declare
    TYPE cur_typ IS REF CURSOR;
    c cur_typ;
    query_str VARCHAR2(4000);
    v_part_num varchar2(40);
    v_inventory_item_id number;
    v_customer_name varchar2(30);
    v_op_name varchar2(240);
    begin
    query_str := 'SELECT partno part_num ,
    item_id inventory_item_id ,
    customer customer_name ,
    hou.name op_name
    FROM hr_organization_units hou,
    oe_transaction_types_all sot ,
    ra_customers rc ,
    ra_addresses_all ra ,
    ra_site_uses_all rsu ,
    oe_order_headers_all h ,
    oe_order_lines_all l ,
    pwr_sod50 ps
    WHERE hou.name =:id1 -- in this place the string need to be concatinated
    and ps.group_id = 9999999
    AND hou.organization_id=h.org_id
    AND ps.line_id =l.line_id
    AND l.header_id =h.header_id
    AND h.invoice_to_org_id=rsu.site_use_id
    AND rsu.address_id =ra.address_id
    AND ra.customer_id =rc.customer_id
    AND h.order_type_id =sot.transaction_type_id
    and rownum<5';
    OPEN c FOR query_str using v_op_name;
    loop
    FETCH c INTO v_part_num,v_inventory_item_id,v_customer_name;
    EXIT WHEN c%NOTFOUND;
    dbms_output.put_line(v_part_num||','||v_inventory_item_id||','||v_customer_name||','||v_op_name);
    end loop;
    CLOSE c;
    end;
    Thanks In Advance!
    Thanks & Regards
    Ramya Nomula

    Hi,
    Code seems Ok, What is the error u get when you execute it?
    Check Execute the SQL Query individually and look into it.
    Check it with sample value to the string which to be concatenated in your code.
    SET SERVEROUTPUT ON;
    DECLARE
        TYPE cur_typ IS REF CURSOR;
        c cur_typ;
        query_str VARCHAR2(4000);
        v_part_num varchar2(40);
        v_inventory_item_id number;
        v_customer_name varchar2(30);
        v_op_name varchar2(240);
    BEGIN
        query_str := '
        SELECT partno part_num ,
            item_id inventory_item_id ,
            customer customer_name ,
            hou.name op_name
        FROM hr_organization_units hou,
            oe_transaction_types_all sot ,
            ra_customers rc ,
            ra_addresses_all ra ,
            ra_site_uses_all rsu ,
            oe_order_headers_all h ,
            oe_order_lines_all l ,
            pwr_sod50 ps
        WHERE hou.name =:id1 -- in this place the string need to be concatinated
            and ps.group_id = 9999999
            AND hou.organization_id=h.org_id
            AND ps.line_id =l.line_id
            AND l.header_id =h.header_id
            AND h.invoice_to_org_id=rsu.site_use_id
            AND rsu.address_id =ra.address_id
            AND ra.customer_id =rc.customer_id
            AND h.order_type_id =sot.transaction_type_id
            and rownum<5';
        OPEN c FOR query_str USING v_op_name;
        LOOP
            FETCH c INTO v_part_num,v_inventory_item_id,v_customer_name;
            EXIT WHEN c%NOTFOUND;
            dbms_output.put_line(v_part_num||','||v_inventory_item_id||','||v_customer_name||','||v_op_name);
        END LOOP;
        CLOSE c;
    END;Thanks,
    Dharan V

  • Give me the sql query which calculte the table size in oracle 10g ecc 6.0

    Hi expert,
    Please  give me the sql query which calculte the table size in oracle 10g ecc 6.0.
    Regards

    Orkun Gedik wrote:
    select segment_name, sum(bytes)/(1024*1024) from dba_segments where segment_name = '<TABLE_NAME>' group by segment_name;
    Hi,
    This delivers possibly wrong data in MCOD installations.
    Depending on Oracle Version and Patchlevel dba_segments does not always have the correct data,
    at any time esp. for indexes right after being rebuild parallel (Even in DB02 because it is using USER_SEGMENTS).
    Takes a day to get the data back in line (never found out, who did the correction at night, could be RSCOLL00 ?).
    Use above statement with "OWNER = " in WHERE for MCOD or connect as schema owner and use USER_SEGMENTS.
    Use with
    segment_name LIKE '<TABLE_NAME>%'
    if you like to see the related indexes as well.
    For partitioned objects, a join from dba_tables / dba_indexes to dba_tab_partitions/dba_ind_partitions to dba_segments
    might be needed, esp. for hash partitioned tables, depending on how they have been created ( partition names SYS_xxxx).
    Volker

Maybe you are looking for