SQL Query works in SQL Developer, but not always in MII

Hi all,
I encountered a strange behaviour with a query in MII 12.0.2. Maybe someone has a guess what happens.
I have created a SQL query which runs against Oracle 10g tables. I have tested the query using SQL Developer, and it throws a couple of lines, depending on the contents of the where clause.
Next I have copied the query to a MII SQL Query (FixedQuery). However, the output is empty most of the time, without showing any errors. After some testing I got the impression that older data are not displayed, but there is no time or date setting in MII.
As the SQL Developer always returns rows, I am unsure where to search for the error.
Regards
Michael

Michael,
I would imagine that you have sub-select statements in your FixedQuery, all which will fall subject to the RowCount property of the query template (SQL defaults to 100), which is issued through the driver and typically honored by the database when returning the data from your request.
Most of the native database query tools allow you to make unbound query requests with no limit on rows, which would probably account for the difference between SQL Developer and the query template.
For SQLServer it's ROWCOUNT:  http://msdn.microsoft.com/en-us/library/ms188774.aspx
For Oracle it's ROWNUM:  http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
So the answer would be not to make the query template row count some rediculous number, but more appropriately refine the way that the database request is issued.
Regards,
Jeremy

Similar Messages

  • SQL query works in access 2000 but not through JDBC

    Hello to all as my first posted message, I have a bit of a pickle on my hands. I have a query which is critical to for my application to function.
    In Access 2000
    SELECT sb.SeatName
    FROM SeatBooking sb, Movie m, MovieSession ms, Booking b
    WHERE m.MovieId = ms.MovieId
    AND ms.MovieSessionId = b.MovieSessionId
    AND b.BookingId = sb.BookingId
    AND ms.DateOfSession = #2003/04/16 07:15:00 PM#;
    This query works fine. When I insert it into my code
    String query = "SELECT sb.SeatName \n" +
    "FROM SeatBooking sb, Movie m, MovieSession ms, Booking b \n" +
    "WHERE m.MovieId = ms.MovieId \n" +
    "AND ms.MovieSessionId = b.MovieSessionId \n" +
    "AND b.BookingId = sb.BookingId \n" +
    "AND ms.DateOfSession = #" +
    cp.getMovieSessionAt(i).getTrueTimeOfSession() + "#;";
    The last line of code returns #2003/04/16 07:15:00 PM#; Which is the exact same as in Access.
    To rule out some possibilities
    - there are other less complicated queries which access the same database but work fine. so my code seems to be ok
    - I have tried to use Format() on ms.DateOfSession to match the return value of the java statement (Which is a general date in Access in the format of 16/04/2003 7:15:00 PM)
    Any suggestions would be appreciated!

    Hi Simon,
    On my Windows XP system with J2SE SDK version 1.4.1_02 and Micro$oft Access 2002, I have the following table:
    column name    column type
    id             Number
    name           Text
    updated        Date/TimeUsing the JDBC-ODBC bridge driver (that is part of the J2SE distribution), the following code uses the JDBC "escape" syntax -- and it works.
    import java.sql.*;
    public class JdbcOdbc {
      public static void main(String[] args) {
        Connection dbConn = null;
        ResultSet rs = null;
        Statement stmt = null;
        String sql =
          "SELECT * FROM Table1 WHERE updated = {ts '2003-04-13 07:53:23'}";
        try {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          dbConn = DriverManager.getConnection("jdbc:odbc:db1");
          stmt = dbConn.createStatement();
          rs = stmt.executeQuery(sql);
          if (rs.next()) {
            System.out.println("id      = " + rs.getInt(1));
            System.out.println("name    = " + rs.getString(2));
            System.out.println("updated = " + rs.getTimestamp(3));
        catch (SQLException sqlEx) {
          System.err.println("Database operation failed.");
          sqlEx.printStackTrace();
        catch (ClassNotFoundException cnfEx) {
          System.err.println("JDBC driver class not found");
          cnfEx.printStackTrace();
        finally {
          if (rs != null) {
            try {
              rs.close();
            catch (SQLException sqlEx) {
              System.err.println("ERROR: Failed to close result set");
              sqlEx.printStackTrace();
          if (stmt != null) {
            try {
              stmt.close();
            catch (SQLException sqlEx) {
              System.err.println("ERROR: Failed to close statement");
              sqlEx.printStackTrace();
          if (dbConn != null) {
            try {
              dbConn.close();
            catch (SQLException sqlEx) {
              System.err.println("ERROR: Failed to close DB connection");
              sqlEx.printStackTrace();
    }More details about the JDBC escape syntax are available here:
    http://java.sun.com/j2se/1.4.1/docs/guide/jdbc/getstart/statement.html#999472
    Hope this helps you.
    Good Luck,
    Avi.

  • SQL Query works in Simulator VC but not in flash deploy

    Hi:
    This is the select that works in VC's simulator:
    SELECT
    "t1"."VUELO", "t1"."HORA SALIDA", "t1"."DURACION", "t1"."ORIGEN", "t1"."DESTINO", "t1"."DIAS"
    FROM
    "RPADMIN"."VUELOS_SEMANAL_EPN_VIRGO" "t1"
    WHERE
    "t1"."DIAS" LIKE <b>'%1%'</b>
    ORDER BY "t1"."HORA SALIDA" ASC
    The big problem seems to be the LIKE clause, I need to find all records that have the number one.
    If I select the Simulator tab the data is bring on but If I perform a flash deploy a null message is display at app's execution. The system is well define and If I change the LIKE clause for LIKE <b>'1'</b> the flash app brings data (not all the records that contains the number 1).
    Thanks a lot for the time on this thread.
    RLS

    Thanks Prakash Darj.
    I read that PDF before starting the thread but I can't make it work...I read it once again and no luck...
    My app is a basic one: start point with a link to a SQL statement linked to a result table
    <b>The SQL sentences that work at the simulator don't work for a flex app, Did you know the reason?</b>
    Often I get this error when deploying as flash app:
    Error in executing a process for Flex compilation, Error 1103: There is no property with the name 'NEUQUEN'.
          (D:\usr\sap\PD0\JC00\j2ee\cluster\server0\GUIMachine_Business_Packages\ModelName_20931\FLEX_COMPILATION_FOLEDR\AAD1W1.mxml:205)
    Failed to compile AAD1W1.mxml
    Is it that my VC is not working fine?
    I want to know the reason for what the Simulator display the data and not the flex app...is the same app....
    any Idea?
    Thanks so much for the time on this thread and for your answer.
    RLS

  • Form auto query works in 10g developer, but not when served by forms server

    I have a form with a master and two detail blocks on the same canvas. When I run it from the developer tool on my desktop, it works great, the master block populates as expected based on the GO_BLOCK and EXECUTE_QUERY statements, and the detail blocks both populate automatically, firing their POST_QUERY triggers as well. When I run it on the server, I have to execute query manually, and then navigate to each of the detail blocks and then execute their queries manually too. When I do that, their POST_QUERY triggers are not firing.
    Desktop is (Windows XP Professional version 5.1 build 2600.xpsp_sp3_gdr.100427-1636 : Service Pack 3)
    Developer version is Forms [32 Bit] Version 10.1.2.0.2 (Production)
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Oracle Toolkit Version 10.1.2.0.2 (Production)
    PL/SQL Version 10.1.0.4.2 (Production)
    Oracle Procedure Builder V10.1.2.0.2 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle Query Builder 10.1.2.0.2 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
    Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE     10.1.0.4.0     Production
    Server version is OAS forms/reports install – 10.1.2.3
    OS – x86-64bit (Red Hat Enterprise Linux Server release 5.4)

    hello,
    does oracle showing any errors in user_scheduler_job_run_details for this job ? I would advise try inserting some debug statement to identify where exactly its stuck. Also please check sample configurations syntax for user_scheduler_jobs.
    Cheers
    Sush

  • SQL query works in the SQLPlus, but fires parse error after being cut and pasted into

    One of our client has a SQL query like this:
    SQL> SELECT LNAME,
    2 QUOTA/12,
    3 (SELECT SUM(CAMT) FROM CONSULTING WHERE CONSULTANT = P.EMPLOYEE
    4 AND ACTIVITYCODE = 'C'AND
    5 CDATE BETWEEN '01-JAN-2001' AND '31-JAN-2001') AS SUM,
    6 (SELECT SUM(CAMT) FROM CONSULTING WHERE CONSULTANT = P.EMPLOYEE
    7 AND ACTIVITYCODE = 'C'AND
    8 CDATE BETWEEN '01-JAN-2001' AND '31-JAN-2001') -
    QUOTA/12 AS PL
    9 FROM PERSONNEL P
    10 ORDER BY LNAME;
    Running the above query in the SQLPlus returns appropriate resultsets to the
    user. After the same SQL being cut and pasted into a portal report
    component, running the report component fires the following error:
    Failed to parse query
    Error:ORA-00911: invalid character (WWV-11230)
    Failed to parse as XXX - SELECT LNAME, QUOTA/12, (SELECT SUM(CAMT) FROM
    CONSULTING WHERE CONSULTANT = P.EMPLOYEE AND ACTIVITYCODE = 'C'AND CDATE
    BETWEEN '01-JAN-2001' AND '31-JAN-2001') AS SUM, (SELECT SUM(CAMT) FROM
    CONSULTING WHERE CONSULTANT = P.EMPLOYEE AND ACTIVITYCODE = 'C'AND CDATE
    BETWEEN '01-JAN-2001' AND '31-JAN-2001') - QUOTA/12 AS PL FROM PERSONNEL P
    ORDER BY LNAME; (WWV-08300)
    Cursor is not open
    Is this because of the multi-table queries, or something else? Is there any
    way around this? Any information regarding this will be highly appreciated.
    Thanks.
    null

    Sunny,
    From the error message that you posted it seems that you are putting a semicolon ";" at the end of your query. I checked the query that you have posted. It is working fine for me. (I am using 3.0.8) but I feel it will work in your version also. I tried the query without a ";" at the end --It worked.
    I tried with ";" at the end -- It gave the error that you have posted. So remove the ";" at the end and it should work. If you are still getting the same error then pls write down the version you are using. I will check in that version.
    Thanx,
    Chetan.

  • Cursor query works in anonymous block but not in procedure

    Hello,
    My cursor query works fine in anonymous blcok but fails in pl/sql block.
    Anonymous block:
    declare
    cursor c1 is
    select object_name
    from all_objects
    where owner='IRIS_DATA'
    and object_type='SEQUENCE';
    v_string varchar2(2000);
    begin
    for c2 in c1 loop
    v_string := 'DROP SEQUENCE IRIS_DATA.'||c2.object_name;
    execute immediate v_string;
    end loop;
    commit;
    exception
    when others then
    dbms_output.put_line('Exception :'||sqlerrm);
    end;
    works fine.
    but inside the procedure the it doesn't go inside the cursor loop
    procedure get_sequence is
    l_dp_handle NUMBER;
    v_job_state varchar2(4000);
    l_last_job_state VARCHAR2(30) := 'UNDEFINED';
    l_job_state VARCHAR2(30) := 'UNDEFINED';
    l_sts KU$_STATUS;
    v_logs ku$_LogEntry;
    v_row PLS_INTEGER;
    v_string1 varchar2(2000);
    cursor seq_obj is
    select object_name
    from all_objects
    where owner='IRIS_DATA'
    and object_type='SEQUENCE';
    begin
         log_status('get_sequence started.');
         --Cursor records to drop the sequences before importing.
         for seq_obj_rec in seq_obj loop
    log_status('get_sequence: Dropping sequence started.');
         v_string1 := 'DROP SEQUENCE IRIS_DATA.'||seq_obj_rec.object_name;
    execute immediate v_string1;
         end loop;
         log_status('get_sequence: Dropping sequence completed.');
    exception
    WHEN OTHERS THEN
    log_status('get_sequence: exception.');
    end get_sequence;
    it's not going into the seq_obj_rec cursor.
    I granted select on all_objects to the user.this user is also having the DBA role as well.
    Please advice.

    PROCEDURE Get_sequence
    IS
      l_dp_handle      NUMBER;
      v_job_state      VARCHAR2(4000);
      l_last_job_state VARCHAR2(30) := 'UNDEFINED';
      l_job_state      VARCHAR2(30) := 'UNDEFINED';
      l_sts            KU$_STATUS;
      v_logs           KU$_LOGENTRY;
      v_row            PLS_INTEGER;
      v_string1        VARCHAR2(2000);
      CURSOR seq_obj IS
        SELECT object_name
        FROM   all_objects
        WHERE  owner = 'IRIS_DATA'
               AND object_type = 'SEQUENCE';
    BEGIN
        Log_status('get_sequence started.');
        --Cursor records to drop the sequences before importing.
        FOR seq_obj_rec IN seq_obj LOOP
            Log_status('get_sequence: Dropping sequence started.');
            v_string1 := 'DROP SEQUENCE IRIS_DATA.'
                         ||seq_obj_rec.object_name;
            EXECUTE IMMEDIATE v_string1;
        END LOOP;
        Log_status('get_sequence: Dropping sequence completed.');
    EXCEPTION
      WHEN OTHERS THEN
                 Log_status('get_sequence: exception.');
    END get_sequence; How do I ask a question on the forums?
    SQL and PL/SQL FAQ
    scroll down to #9 & use tags in the future.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Query working fine in toad but not in forms 6i

    i have following coding on when button press triger
    declare
    CURSOR C1(year number,month number) IS
    SELECT ITM_NO,ITM_NAME,XAQ QTY,XAQ*TP VAL,gp
    FROM
    select ci.itm_no ITM_NO,ci.itm_name ITM_NAME ,cpg.group_id gp ,xaq ,ALLIED.CORP_PRIC_TP( ci.itm_no)TP from
    select prod_no,sum(xaq)*1 xaq
    from
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_01_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_02_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_03_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_04_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    group by prod_no
    ) A,allied.corp_inv ci,allied.corp_01_01 c01, allied.corp_01_02 c02,allied.corp_prod_group cpg,allied.v_prod_grp vpg
    where ci.itm_no=a.prod_no
    and ci.itm_no=c02.itm_no
    and c01.grp_id=c02.grp_id
    and c01.grp_id in(55,56,57,58,59)
    and vpg.prod_no =ci.itm_no
    and vpg.group_id=cpg.group_id
    where XAQ <>0;
    Begin
         delete from fiaz.tmp_topten_prod;
         for i in c1(:year,:month)
    loop
              insert into fiaz.tmp_topten_prod
              values(i.itm_no,i.itm_name,i.qty,i.val,i.gp,0);
         end loop;      
    standard.commit;
    message('inserted in temp');
         exception when others then
              message (dbms_error_text);
              message (dbms_error_text);
    End;
    Same Query (as used in cursor c1) works fine in toad but giving wrong result from forms... and the problem is xaq field i.e returns incorrect qty...
    i guess union clause is not working in this situation...
    plz suggest me the appropriate changes in the query to work well from form as well...
    combination:Forms 6i,Oracle 8.0.6
    Regards,
    Usman Afzal

    As per your suggestion i have created a stored procedure but the followin error prevents procedure creation
    create or replace procedure fiaz.topten_prod(v_yr number,v_mn number) is
    begin
    delete from fiaz.tmp_topten_prod;
    insert into fiaz.tmp_topten_prod(itm_no,itm_name,qty,val,grp_id,prority)
    SELECT ITM_NO,ITM_NAME,XAQ QTY,XAQ*TP VAL,gp,0
    FROM
    select ci.itm_no ITM_NO,ci.itm_name ITM_NAME ,cpg.group_id gp ,xaq ,ALLIED.CORP_PRIC_TP( ci.itm_no)TP from
    select prod_no,sum(xaq) xaq
    from
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq from allied.mrk_01_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_02_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_03_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_04_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    group by prod_no
    ) A,allied.corp_inv ci,allied.corp_01_01 c01, allied.corp_01_02 c02,allied.corp_prod_group cpg,allied.v_prod_grp vpg
    where ci.itm_no=a.prod_no
    and ci.itm_no=c02.itm_no
    and c01.grp_id=c02.grp_id
    and c01.grp_id in(55,56,57,58,59)
    and vpg.prod_no =ci.itm_no
    and vpg.group_id=cpg.group_id
    where XAQ <>0;
    commit;
    end;
    Error:
    "PLS-00201: identifier ALLIED.MRK_01_02 must be declared "
    i have not changed any thing in query working fine in toad without create procedure text and if i describe this table it shows the structure (desc allied.mrk_01_02)
    Now where is the problemmmmm
    Plz Help

  • Query works in DB GUI, but not in CF

    Hello,
    I keep getting a CF error of "invalid character" for the
    attached query.
    Detailed error message: [Macromedia][Oracle JDBC
    Driver][Oracle]ORA-00911: invalid character
    I realize that's an Oracle error code, but the query works in
    an Oracle db GUI (Toad).
    Has anyone experienced this kind of situation?
    Thank you.

    I've never tried using DDL in a CFQUERY myself with an Oracle
    db, but you might try putting the entire statement inline (as in a
    single line), rather than breaking it out like you did. It would be
    hard to read, but it might parse better....... just a thought. I've
    had similar problems with EXECUTE statements within a CFQUERY that
    worked just fine when I rewrote them with no line breaks, etc.
    Phil

  • SQL Query works in MS Access but caused SQL exception

    Hi all,
    I've got this query that works if I run it in MS Access but caused an SQL Exception if I run in my Java programme.
    The query
    SELECT Count(*) AS countPlayerMax FROM (SELECT Count(*) AS countSent, sent.mobileno FROM sent WHERE (((sent.date_sent) Between #2002-3-1# And #2002-3-8#)) GROUP BY sent.mobileno HAVING (((Count(*))>100)))
    The exception is
    [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
    I've done nested queries before but this one doesn't work. Any ides why??
    thanks

    Thanks for your suggestion
    I tried it but it still gives the same error, now the SQL looks like this
    SELECT Count(*) AS countPlayerMax FROM (SELECT Count(*) AS countSent, sent.mobileno FROM sent WHERE sent.date_sent Between #2002-3-1# And #2002-3-8# GROUP BY sent.mobileno HAVING Count(*)>100)
    the exception is the same
    [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

  • Same SQL Statement Works in Data Service but not in its Input Port

    Hi Experts,
    I am using this query in one of my data service. Test execute success which returned:
                                            E      U      H     M      L
    2     Less Than 1 Week     0     0     0     0     0
    3     1 - 2 weeks          0     0     0     0      0
    4     2 - 4weeks          0     0     0     0      0
    5     More Than 1 Month     0     0     6     0     0
    However, when i copy the same query to the input port, enclosing it with "[my query]"
    Deployed and run it. I get an "Unspecified Error" message box prompted in the iView, and null pointer exception error in the log file.
    #1.5 #001A64CA3F5600660000034400001140000487DBB6D27A4D#1275277641800#com.sap.portal.visualComposer_NWBIKit_logger#sap.com/irj#com.sap.portal.visualComposer_NWBIKit_logger#TOMAS004#89896##n/a##37c590906c6711df8503001a64ca3f56#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###null
    [EXCEPTION]
    #1#java.lang.NullPointerException
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.processTemplateParams(BIRelationalQuerySql.java:40)
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.<init>(BIRelationalQuerySql.java:31)
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalFactory.newRelationalQuery(BIRelationalFactory.java:59)
    Any idea what is the mistake?
    Thanks in Advance,
    Sarah

    Hi Experts,
    I am using this query in one of my data service. Test execute success which returned:
                                            E      U      H     M      L
    2     Less Than 1 Week     0     0     0     0     0
    3     1 - 2 weeks          0     0     0     0      0
    4     2 - 4weeks          0     0     0     0      0
    5     More Than 1 Month     0     0     6     0     0
    However, when i copy the same query to the input port, enclosing it with "[my query]"
    Deployed and run it. I get an "Unspecified Error" message box prompted in the iView, and null pointer exception error in the log file.
    #1.5 #001A64CA3F5600660000034400001140000487DBB6D27A4D#1275277641800#com.sap.portal.visualComposer_NWBIKit_logger#sap.com/irj#com.sap.portal.visualComposer_NWBIKit_logger#TOMAS004#89896##n/a##37c590906c6711df8503001a64ca3f56#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###null
    [EXCEPTION]
    #1#java.lang.NullPointerException
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.processTemplateParams(BIRelationalQuerySql.java:40)
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.<init>(BIRelationalQuerySql.java:31)
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalFactory.newRelationalQuery(BIRelationalFactory.java:59)
    Any idea what is the mistake?
    Thanks in Advance,
    Sarah

  • Query works in Oracle Client but not JDBC

    The query is as follows:
    SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '15-JAN-01' and '15-JAN-03';When I run this query in the Oracle client (SQL+) it tells me that THE_COUNT is 4 which is correct but when I use the following JDBC code I get THE_COUNT is 0 which is incorrect.
    public ResultSet viewTotalSentOrdersByDate()
      throws SQLException, Exception {
          String beginDate = "15-JAN-01";
          String endDate = "15-JAN-03";
          ResultSet rs = null;
        try  {
          String queryString = ("SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '" + beginDate + "' and '" + endDate + "'");
          System.out.println(queryString);
          Statement stmt = con.createStatement();
          rs = stmt.executeQuery(queryString);
          while(rs.next()) {
           System.out.println(rs.getString("THE_COUNT"))
        } catch (SQLException sqle) {
          error = "SQLException: Could not execute the query.";
          throw new SQLException(error);
        } catch (Exception e) {
          error = "An exception occured.";
          throw new Exception(error);               
        return rs;
      }Thanks for the help
    Zac

    The query is as follows:
    SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '15-JAN-01' and '15-JAN-03';When I run this query in the Oracle client (SQL+) it tells me that THE_COUNT is 4 which is correct but when I use the following JDBC code I get THE_COUNT is 0 which is incorrect.
    public ResultSet viewTotalSentOrdersByDate()
    throws SQLException, Exception {
    String beginDate = "15-JAN-01";
    String endDate = "15-JAN-03";
    ResultSet rs = null;
    try {
    String queryString = ("SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '" + beginDate + "' and '" + endDate + "'");
    System.out.println(queryString);
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    while(rs.next()) {
    System.out.println(rs.getString("THE_COUNT"))
    } catch (SQLException sqle) {
    error = "SQLException: Could not execute the query.";
    throw new SQLException(error);
    } catch (Exception e) {
    error = "An exception occured.";
    throw new Exception(error);
    return rs;
    }Thanks for the help
    Zac

  • Query works as two queries, but not as one

    I am beating my head against the wall trying to figure out why a query will not return, yet when I break it up into two queries, they both return successfully.
    There is a text index on the text_a field.
    This is my query:
    select distinct /*+ */ table_c.rec_id
    from table_d, table_n, table_c
    where ( ((create_date >='2006-03-16T00:00:00Z')
    and (misc_field='abcd')
    and (contains( text_a,'ABC or DEF or GHI or JKL or MNP') > 0 ))
    /* and (rownum <=2000) */)
    and table_c.rec_id = table_d.rec_id
    and table_c.create_date = table_d.create_date
    and table_c.rec_id = table_n.rec_id
    and table_c.create_date = table_n.create_date
    This query will not return data. I get an ora-1555 every time I let it run. The longest I let it run before getting the 1555 error was 1 hr and 50 min.
    Tests suspecting a text data problem:
    Now, here's what's puzzling. The query will run if 'JKL' is taken out. So, I thought this value may be the problem, so I ran the query with just the 'JKL' value in the "contains" clause and it did not return a value.
    Tests suspecting a date problem:
    Now, even more strange: When I ran the query (with all 5 conditions for misc_field) and looked from 2006-03-17T00:00:00Z, it returned records in less than 5 minutes. Then I queries just the 16th (create_date>='2006-03-16T00:00:00Z' and create_date < '2006-03-17T00:00:00Z' and it returned rows in less than 1 minute. So, I looked at the tokens for those dates, and there are values for all of them for each of the dates from the 16th to the present (the 21st). However, when I put them together in the query above, the query just seems to hang.
    The total number of rows that should be returned is around 650 (adding the two results that worked).
    Any suggestions? The indexes are valid, syncing is up-to-date, optimizing has no errors,a nd there are token_counts for the tokens in the $I table for the text_a field.
    This problem has crossed into a second day and the same value of the 16th (as in the query above) is still used and still does not return rows. What else should I be looking at?
    In advance, thanks for any suggestions/assistance.
    - Jenny

    I believe the 1555 error is an obscure response to (i.e. a result of) another problem.
    The create_date column is a date datatype. The NLS format matches at the session, instance and database level (nls_session_parameters, and instance, and database). The NLS_DATE_FORMAT is set to YYYY-MM-DD"T"HH24:MI:SS"Z" in each of those views. Would this still cause a potential problem?
    I neglected to say that we are on version 9.2.0.7 (both the data dictionary and the binaries).
    The response from raford suggests that the optimizer is causing the text index to be called in "functional lookup" mode. I tried testing it, forcing it to use an index. The query ran in 3.5 minutes. Then I tested the original query and received the same results. After checking with the other DBAs, one of them was updating statistics on partitions for previous days' data. The statistics were only being run on current data partitions for the current day, but apparently the method that the application uses to "update" data (which could be for previous days) is to delete it and then insert it. I am suspecting that this is the root cause of all our evil! We are currently working with the developers to get this design changed. In the meantime, I REALLY appreciate all the help/suggestions. If we see the problem occur again, we will add the hint to test and verify whether or not that is the cause. I suspect it will be. Thank you raford.
    Darn that optimizer!!!! ;-)
    Oh, just a hint: Using set autotrace traceonly explain will NOT show that each of the text index partitions is being scanned. This was what we were using for our explain plans. But, when another query, with a similar problem, was finally run, we used EM and the "Long Ops" tab to finally see that each partition was being scanned for the token, whether it needed it or not. I think I'll go back to Tom Kyte's website and look for that article on the set autotrace traceonly explain not giving a totally accurate explain plan.
    Thanks again.
    - Jenny

  • IP - Issues with Input Query: Works on Bex analyzer but not on Web

    I am doing the following:
    Created a Aggregation level for a multi provider which has only real time infoproviders associated with it
    Created the query using Bex Query Designer availing all the options for planning
    When I execute this query it executes using a web template and does not open up the Key Figure cells for input, I had tried using the Web Application designer with Save button but still the same issue
    I tried the same on Bex analyzer and it works fine
    Please help to resolve the above issue.
    Thanks in advance.

    Hi Ram,
    Cells should be input enabled on the web just running the query. No need to create a Webtemplate, altough you need to have the webtemplate to be able to use the "save data" function.
    Maybe your query is not input ready at all, and you're misinterpreting analyzer layout.
    To test this, please enter some plan data in analyzer, right click and choose "save".
    Please check if data is written to the real time infoprovider.
    Hope this helps you.
    Regards,
    Miguel P.

  • Query works in Tera Term but not in Telnet Read.vi

    I am using Telnet Write.vi to execute a command such as GET_VERSION
    Then using Telnet Read.vi, I am expecting several lines to be returned.
    This works if I manually do this with Tera Term.
    But with LabVIEW, the Telnet Read.vi simply returns the command from the Telnet Write.vi
    What do I have to configure to change this behavior?

    Edit:
    Needed to add carriage return +  newline 
    DUH.

  • Query working fine in 9i but throwing an error in Oracle 10g

    Hi All,
    I am having a query which contains large number of When clauses inside a case statement.
    The Same SQL is working fine in 9i, but not working in 10G.
    If we try to remove one of the When clause in the query, its working fine else it is giving the error ORA-00939 Too many arguments for functions.
    Can any one tell me the solution for this and what is the maximum number of when clauses allowed inside case statemen in oracle 10g.
    Thanks in advance
    Regards
    Karthik

    it should not have worked in 9iR2... it is correct according to the doc to return an error message when using more than 255 expressions...
    SQL> select version from v$instance;
    VERSION
    9.2.0.7.0
    SQL> select case 1
      2  when 2 then 3
      3  when 4 then 5
      4  when 6 then 7
      5  when 8 then 9
      6  when 10 then 11
      7  when 12 then 13
      8  when 14 then 15
      9  when 16 then 17
    10  when 18 then 19
    11  when 20 then 21
    12  when 22 then 23
    13  when 24 then 25
    14  when 26 then 27
    15  when 28 then 29
    16  when 30 then 31
    17  when 32 then 33
    18  when 34 then 35
    19  when 36 then 37
    20  when 38 then 39
    21  when 40 then 41
    22  when 42 then 43
    23  when 44 then 45
    24  when 46 then 47
    25  when 48 then 49
    26  when 50 then 51
    27  when 52 then 53
    28  when 54 then 55
    29  when 56 then 57
    30  when 58 then 59
    31  when 60 then 61
    32  when 62 then 63
    33  when 64 then 65
    34  when 66 then 67
    35  when 68 then 69
    36  when 70 then 71
    37  when 72 then 73
    38  when 74 then 75
    39  when 76 then 77
    40  when 78 then 79
    41  when 80 then 81
    42  when 82 then 83
    43  when 84 then 85
    44  when 86 then 87
    45  when 88 then 89
    46  when 90 then 91
    47  when 92 then 93
    48  when 94 then 95
    49  when 96 then 97
    50  when 98 then 99
    51  when 100 then 101
    52  when 102 then 103
    53  when 104 then 105
    54  when 106 then 107
    55  when 108 then 109
    56  when 110 then 111
    57  when 112 then 113
    58  when 114 then 115
    59  when 116 then 117
    60  when 118 then 119
    61  when 120 then 121
    62  when 122 then 123
    63  when 124 then 125
    64  when 126 then 127
    65  when 128 then 129
    66  when 130 then 131
    67  when 132 then 133
    68  when 134 then 135
    69  when 136 then 137
    70  when 138 then 139
    71  when 140 then 141
    72  when 142 then 143
    73  when 144 then 145
    74  when 146 then 147
    75  when 148 then 149
    76  when 150 then 151
    77  when 152 then 153
    78  when 154 then 155
    79  when 156 then 157
    80  when 158 then 159
    81  when 160 then 161
    82  when 162 then 163
    83  when 164 then 165
    84  when 166 then 167
    85  when 168 then 169
    86  when 170 then 171
    87  when 172 then 173
    88  when 174 then 175
    89  when 176 then 177
    90  when 178 then 179
    91  when 180 then 181
    92  when 182 then 183
    93  when 184 then 185
    94  when 186 then 187
    95  when 188 then 189
    96  when 190 then 191
    97  when 192 then 193
    98  when 194 then 195
    99  when 196 then 197
    100  when 198 then 199
    101  when 200 then 201
    102  when 202 then 203
    103  when 204 then 205
    104  when 206 then 207
    105  when 208 then 209
    106  when 210 then 211
    107  when 212 then 213
    108  when 214 then 215
    109  when 216 then 217
    110  when 218 then 219
    111  when 220 then 221
    112  when 222 then 223
    113  when 224 then 225
    114  when 226 then 227
    115  when 228 then 229
    116  when 230 then 231
    117  when 232 then 233
    118  when 234 then 235
    119  when 236 then 237
    120  when 238 then 239
    121  when 240 then 241
    122  when 242 then 243
    123  when 244 then 245
    124  when 246 then 247
    125  when 248 then 249
    126  when 250 then 251
    127  when 252 then 253
    128  when 254 then 255
    129  when 256 then 257
    130  end x from dual;
             X
    SQL> select version from v$instance;
    VERSION
    10.2.0.2.0
    SQL> select case 1
      2  when 2 then 3
      3  when 4 then 5
      4  when 6 then 7
      5  when 8 then 9
      6  when 10 then 11
      7  when 12 then 13
      8  when 14 then 15
      9  when 16 then 17
    10  when 18 then 19
    11  when 20 then 21
    12  when 22 then 23
    13  when 24 then 25
    14  when 26 then 27
    15  when 28 then 29
    16  when 30 then 31
    17  when 32 then 33
    18  when 34 then 35
    19  when 36 then 37
    20  when 38 then 39
    21  when 40 then 41
    22  when 42 then 43
    23  when 44 then 45
    24  when 46 then 47
    25  when 48 then 49
    26  when 50 then 51
    27  when 52 then 53
    28  when 54 then 55
    29  when 56 then 57
    30  when 58 then 59
    31  when 60 then 61
    32  when 62 then 63
    33  when 64 then 65
    34  when 66 then 67
    35  when 68 then 69
    36  when 70 then 71
    37  when 72 then 73
    38  when 74 then 75
    39  when 76 then 77
    40  when 78 then 79
    41  when 80 then 81
    42  when 82 then 83
    43  when 84 then 85
    44  when 86 then 87
    45  when 88 then 89
    46  when 90 then 91
    47  when 92 then 93
    48  when 94 then 95
    49  when 96 then 97
    50  when 98 then 99
    51  when 100 then 101
    52  when 102 then 103
    53  when 104 then 105
    54  when 106 then 107
    55  when 108 then 109
    56  when 110 then 111
    57  when 112 then 113
    58  when 114 then 115
    59  when 116 then 117
    60  when 118 then 119
    61  when 120 then 121
    62  when 122 then 123
    63  when 124 then 125
    64  when 126 then 127
    65  when 128 then 129
    66  when 130 then 131
    67  when 132 then 133
    68  when 134 then 135
    69  when 136 then 137
    70  when 138 then 139
    71  when 140 then 141
    72  when 142 then 143
    73  when 144 then 145
    74  when 146 then 147
    75  when 148 then 149
    76  when 150 then 151
    77  when 152 then 153
    78  when 154 then 155
    79  when 156 then 157
    80  when 158 then 159
    81  when 160 then 161
    82  when 162 then 163
    83  when 164 then 165
    84  when 166 then 167
    85  when 168 then 169
    86  when 170 then 171
    87  when 172 then 173
    88  when 174 then 175
    89  when 176 then 177
    90  when 178 then 179
    91  when 180 then 181
    92  when 182 then 183
    93  when 184 then 185
    94  when 186 then 187
    95  when 188 then 189
    96  when 190 then 191
    97  when 192 then 193
    98  when 194 then 195
    99  when 196 then 197
    100  when 198 then 199
    101  when 200 then 201
    102  when 202 then 203
    103  when 204 then 205
    104  when 206 then 207
    105  when 208 then 209
    106  when 210 then 211
    107  when 212 then 213
    108  when 214 then 215
    109  when 216 then 217
    110  when 218 then 219
    111  when 220 then 221
    112  when 222 then 223
    113  when 224 then 225
    114  when 226 then 227
    115  when 228 then 229
    116  when 230 then 231
    117  when 232 then 233
    118  when 234 then 235
    119  when 236 then 237
    120  when 238 then 239
    121  when 240 then 241
    122  when 242 then 243
    123  when 244 then 245
    124  when 246 then 247
    125  when 248 then 249
    126  when 250 then 251
    127  when 252 then 253
    128  when 254 then 255
    129  when 256 then 257
    130  end x from dual;
    when 16 then 17
    ERROR at line 9:
    ORA-00939: too many arguments for function
    SQL> del 129
    SQL> /
             X
    ----------

Maybe you are looking for

  • "no serializer is registered..." error with a web service not working

    I'm using JDeveloper 10.1.3 EJB 3.0 I'm having issues with the web service not working after I create a client for it. The web service works fine up until I generate the proxy on the other side. ERROR An error occurred for port: {http://buslogic/}MyW

  • Best workflow for splitting up a long video into series of short videos

    I've got an hour worth of footage, a series of speakers, each who speak about 3 min. I want each speaker to be a separate video on youtube. What's the fastest workflow for doing this? Also, why does youtube export take so long in Final Cut Pro? It's

  • I'm trying to arrange albums in folders

    Hi Is there a way to add music inside folders ? for example when I create a folder in my iPOD named "Pink Floyd" .. I want all the different albums by this band to be in different folders inside the main folder : Pink Floyd -->Animals Dark side of th

  • Details about the packet capture output bits...

                       Hi Mates, If we take the packet capture output, we will get similar output as follows: Please explain the significance of the highlighted bits values. (S,P,F and . ) If tehre is ny doc related to them, appreciate to share. Thanks &

  • SAP Productivity Pak for Us customer

    Hello Experts, We have a requirement from client to install the RWD productivity pak for training documents and I have heard this name first time and I already instaalled the Solman 7.1 and Dev box of CRM 7 EHP 1 and ECC EHP 5. I have below queries-