Another problem:  query in oracle

Hello guys,
I have a problem in a SQL code in a program that uses a Oracle connection.
The code:
public class ConBol {
     public void getDataBol() {
          String sql = "SELECT * FROM DOCUMENT_FISC  WHERE NRDOC_FISC = ?";
          try {
               Connection conn = new ConnectionFactory().getConnection();
               PreparedStatement stmt = conn.prepareStatement(sql);
               stmt.setInt(1, 3969);
               ResultSet rs = stmt.executeQuery();
               System.out.println("here -- ");
               while (rs.next()) {
                    System.out.println("---while--- ");
                    System.out.println(rs.getString(1));
               rs.close();
               stmt.close();
               try {
                    conn.close();
               } catch (SQLException ex) {
                    Logger.getLogger(ConBol.class.getName()).log(Level.SEVERE, null, ex);
          } catch (SQLException ex) {
               Logger.getLogger(ConBol.class.getName()).log(Level.SEVERE, null, ex);
}When my SQL is only "Select * from myTable", the resultSet get all the data and the "System.out" inside the "while", works, showing me the data.
When I put a "where" on my SQL, the resultSet returns nothing, and the column that I ask, has items inside and the query should return me at least one row.
I really don't know what more can I do to solve this problem.
The server is Oracle 11g.
I try in Windows 7 and Windows XP SP3.
I try to use 3 diferent oracle drivers: ojdbc6.jar , ojdbc14.jar and class12.jar.
I try Eclipse and Netbeans, PreparedStatement and Statement, table name and column name in uppercase and lowercase, with alias, with other users from DB and no one solve the problem.
The data base connection is ok. When I copy and paste the SQL on the SQLDeveloper, the query works fine and show me results.
The program don't give any errors or exceptions, but doesn't work when I have a "where something".
If I put "where 1=1" he works fine.
Any help??

Artur,
I make the tests that you ask me to do and it works!!!
The value returned from the "select distinct" work when I put him on the original query.
I just can't understand how can this work if the another value that I pass to the query exists in the table too.
How can one value that exists, don't return me nothing?
At least, now I can be sure that the code is alright.
Thank's a lot friend, for you and JSchell. I will make more tests to try understand how this can happen.
Edit: I try to count the rows of that table. In PLSQL Developer, the row count was 5860. In the java code was 4730.
Can be out of memory in the resultSet?
Edited by: Herick on Dec 29, 2009 2:34 AM
Edit2: Forget what I said. I use the "Select count" and the resultSet came with just one result, so can't be memory problem.
Edited by: Herick on Dec 29, 2009 2:39 AM

Similar Messages

  • Problem querying an Oracle Database using PHP

    Hi there, im rather new to Oracle so pardon my ignorance if this is completely obvious but I am creating a web form that queries an oracle database, firstly is a user form which looks like this.
    <br><br>
    Search for Investments<br>
    <form action="query.php" method="POST"><br>
    <input type = "text" name = "invest"><br>
    <input type="submit" value="Search" name="submit" /><br>
    </form><br>
    -----------------------<br><br>
    and the php script which looks like this<br><br>
    -----------------------<br><br>
    <?php<br><
    print "<HTML><PRE>";<br><br>
    require_once('connect.php');<br>
    select_data($conn);<br><br>
    $invest = $_POST['invest'];<br>
    echo "Returning results related to $invest";<br><br>
    function select_data($conn)<br>
    { $stmt = ociparse($conn,"select * from investmentbase where INVTYPE='$invest'");<br>
    ociexecute($stmt,OCI_DEFAULT);<br><br>
    echo "<table border = 1 class=results>";<br><br>
    echo "<tr>";<br>
    echo "<td>Reference Number</td>";<br>
    echo "<td>User ID</td>";<br>
    echo "<td>Investment Type</td>";<br>
    echo "<td>Investment Description</td>";<br>
    echo "<td>Amount Required</td>";<br>
    echo "<td>Due Date<td>";<br>
    echo "</tr>";<br><br>
    while (ocifetch($stmt)){<br>
    echo "<tr>";<br>
    echo "<td>";<br>
    echo ociresult($stmt,"INVREF")." ";<br>
    echo "</td>";<br>
    echo "<td>";<br>
    echo ociresult($stmt,"USERID")." ";<br>
    echo "</td>";<br>
    echo "<td>";<br>
    echo ociresult($stmt,"INVTYPE")." ";<br>
    echo "</td>";<br>
    echo "<td>";<br>
    echo ociresult($stmt,"INVDESCRIPTION")." ";<br>
    echo "</td>";<br>
    echo "<td>";<br>
    echo ociresult($stmt,"AMOUNTREQUIRED")." ";<br>
    echo "</td>";<br>
    echo "<td>";<br>
    echo ociresult($stmt,"REQUIREDATE");<br>
    echo "</td>";<br>
    echo "</tr>";<br><br>
    }<br>
    echo "</table>";<br>
    }<br><br>
    ocilogoff($conn);<br>
    print "</PRE></HTML>";<br>
    ?> <br><br>
    When i search for a value that is in the database no results are returned, however the form is definitely posting the variable as the echo statement on the PHP script displays it. Any ideas would be gratefully appreciated
    Many Thanks
    Paul

    Do you need to set $invest before calling do_select() and pass it as a
    parameter? Also, watch out for SQL Injection security risks. Try
    using a bind variable.
    $invest = $_POST['invest'];
    echo "Returning results related to $invest";
    select_data($conn, $invest);
    function select_data($conn, $invest)
      $stmt = ociparse($conn,"select * from investmentbase where INVTYPE=:ibv");
      ocibindbyname($stmt, ':ibv', $invest);
      ociexecute($stmt,OCI_DEFAULT);
      . . .Although the PHP 4 naming style for oci8 functions can be used with
    PHP 5, I know there is a possibility you are using the PHP 4 OCI8
    extension. If you are, then upgrade at least OCI8. There are some
    notes on this in
    Re: frustrations with oci_fetch_array()
    -- cj

  • Problem with different resultset with same data and same query in Oracle 8.1.7 and 9i

    Hello,
    I have been using this query in oracle 8.1.7
    SELECT
    ID,
    AREA_NO
    FROM MANAGER_AREA MGR
    WHERE COMPANY_ID = :id AND
    (:value < (SELECT COUNT(ROWID)
    FROM MANAGER_WORK MW
    WHERE MW.AREA_ID = MGR.ID AND
    (MW.END_WORK IS NULL OR MW.END_WORK >= SYSDATE)))
    order by AREA_NO;
    In the above query I want to see rows from MANAGER_AREA table depending upon date criteria in the table MANAGER_WORK and also upon the parameter :value i.e if I pass a value as 0 I get to see records for which their is atleast 1 record in MANAGER_WORK with the date criteria and if I pass -1 then I get all the records because minimum value that count(*) would give is 0. The resultset was as expected in 8.1.7.
    A couple of days back I installed PERSONAL 9i to test for testing the basic functionality of our program with the same data. This query fails and irrespective whether I pass -1 or 0 it returns me same dataset which I would have got in case if I pass 0.
    I do not know whether this is a bug that has got introduced in 9i. Can anybody help me with this problem. It would be difficult for me to change the parameter send to this query as the Query is called from many different places.
    Thanks in advance
    Amol.

    I cannot use a Group by and a having statement over here. The problem with 'Group by' and 'having' clause is If I have to make a join between the two tables. When I use join then I get only rows that are linked to each other in the table.
    If I use outer join to solve that problem then I have to take in consideration the other date condition. My previous query use to virtually discard the corelated query result by using -1 as the value. This will not happen in the join query.
    Amol.

  • Conversion of Mysql query in oracle acceptable query format

    Hi
    I have successfully converted my MySql database in oracle. Now the problem is how to execute already written hundreds of Mysql query on the oracle. There are many syntax variation in Mysql query format which is not acceptable for oracle.
    For Example
    Select case_id as 'this is alias' from cases
    The above query can run on Mysql database but have problem while executing Oracle, because single quotes should be replaced with double quotes before executing it on oracle. There are also many other syntax conflicts.
    I have tried to resolve the problem through SwisSQLAPI but problem still exist as SwisSQLAPI is not dealing with all syntax conflict. In my case (select if (expresion, true,false)) must be replace with decode (expression, value,true,false) function of oracle and this conversion is not supported by SwisSQLAPI.
    Please help me in resolving this problem
    Thanks

    The problem with trying to port from one language (mysql SQL) to another (oracle SQL) is that there's generally no hard rules for a computer to follow, that it will get it 100% correct.
    Look at babelfish when you translate a foreign language to English. The end result is readable (usually), but it's rarely completely correct.
    The problem is when you feed something into Oracle SQL, it needs to be 100% correct.
    All you can really do here is rewrite these queries. It shouldn't actually take as long as you think, because 50% of queries will generally need very minor changes you can do in a minute, and 25% won't need any changes at all.

  • Writing query to Oracle DB with DATE field in it.

    When I try to execute the following query on Oracle DB I get an exception. I know that the problem is with Date representation on the query string. Please, if anyone knows how to make it work help me.
    query = "INSERT INTO MYTABLE (NAME , BIRTHDAY ) VALUES ('" + person.getName() +" ' , " + person.getBirthday() + " )";
    statment.executeUpdate(query);
    getBirthday() returns java.sql.Date object.
    Please, please, help to work it out!

    Thank you, very much.
    I've put the record into DB!!!! Hurray!
    But now I have another problem. I've got a ResultSet & I'd like to extract the DATE from it. But how?
    The Exception text states that the name of the field (Birthday) is incorrect.
    My code:
    Date birthday = resultSet.getDate("Birthday");
    All other fields are perfectly well extracted, but they are Strings.

  • Performance problems - query on the copy of a table is faster than the orig

    Hi all,
    I have sql (select) performance problems with a specific table (costs 7800)(Oracle 10.2.0.4.0, Linux).
    So I copied the table 1:1 (same structure, same data, same indexes etc. ) under the same area (database, user, tablespace etc.) and gathered the table_stats with the same parameters. The same query on this copied table is faster and the costs are just 3600.
    Why for gods sake is the query on this new table faster??
    I appreciate any idea.
    Thank you!
    Fibo
    Edited by: user954903 on 13.01.2010 04:23

    Could you please share more information/link which can elaborate the significance of using SHRINK clause.
    If this is so useful and can shrink the unused space , why not my database architect has suggested this :).
    Any disadvantage also?It moves the highwater mark back to the lowest position, therefore full tables scans would work faster in some cases. Also it can reduce number of migrated rows and number of used blocks.
    Disadvantage is that it involves row movement, so operations which based on rowid are permitted during the shrinking.
    I think it is even better to stop all operations on the table when shrinking and disable all triggers. Another problem is that this process can take a long time.
    Guru's, please correct me if I'm mistaken.
    Edited by: Oleg Gorskin on 13.01.2010 5:50

  • Query in timesten taking more time than query in oracle database

    Hi,
    Can anyone please explain me why query in timesten taking more time
    than query in oracle database.
    I am mentioning in detail what are my settings and what have I done
    step by step.........
    1.This is the table I created in Oracle datababase
    (Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)...
    CREATE TABLE student (
    id NUMBER(9) primary keY ,
    first_name VARCHAR2(10),
    last_name VARCHAR2(10)
    2.THIS IS THE ANONYMOUS BLOCK I USE TO
    POPULATE THE STUDENT TABLE(TOTAL 2599999 ROWS)...
    declare
    firstname varchar2(12);
    lastname varchar2(12);
    catt number(9);
    begin
    for cntr in 1..2599999 loop
    firstname:=(cntr+8)||'f';
    lastname:=(cntr+2)||'l';
    if cntr like '%9999' then
    dbms_output.put_line(cntr);
    end if;
    insert into student values(cntr,firstname, lastname);
    end loop;
    end;
    3. MY DSN IS SET THE FOLLWING WAY..
    DATA STORE PATH- G:\dipesh3repo\db
    LOG DIRECTORY- G:\dipesh3repo\log
    PERM DATA SIZE-1000
    TEMP DATA SIZE-1000
    MY TIMESTEN VERSION-
    C:\Documents and Settings\dipesh>ttversion
    TimesTen Release 7.0.3.0.0 (32 bit NT) (tt70_32:17000) 2007-09-19T16:04:16Z
    Instance admin: dipesh
    Instance home directory: G:\TimestTen\TT70_32
    Daemon home directory: G:\TimestTen\TT70_32\srv\info
    THEN I CONNECT TO THE TIMESTEN DATABASE
    C:\Documents and Settings\dipesh> ttisql
    command>connect "dsn=dipesh3;oraclepwd=tiger";
    4. THEN I START THE AGENT
    call ttCacheUidPwdSet('SCOTT','TIGER');
    Command> CALL ttCacheStart();
    5.THEN I CREATE THE READ ONLY CACHE GROUP AND LOAD IT
    create readonly cache group rc_student autorefresh
    interval 5 seconds from student
    (id int not null primary key, first_name varchar2(10), last_name varchar2(10));
    load cache group rc_student commit every 100 rows;
    6.NOW I CAN ACCESS THE TABLES FROM TIMESTEN AND PERFORM THE QUERY
    I SET THE TIMING..
    command>TIMING 1;
    consider this query now..
    Command> select * from student where first_name='2155666f';
    < 2155658, 2155666f, 2155660l >
    1 row found.
    Execution time (SQLExecute + Fetch Loop) = 0.668822 seconds.
    another query-
    Command> SELECT * FROM STUDENTS WHERE FIRST_NAME='2340009f';
    2206: Table SCOTT.STUDENTS not found
    Execution time (SQLPrepare) = 0.074964 seconds.
    The command failed.
    Command> SELECT * FROM STUDENT where first_name='2093434f';
    < 2093426, 2093434f, 2093428l >
    1 row found.
    Execution time (SQLExecute + Fetch Loop) = 0.585897 seconds.
    Command>
    7.NOW I PERFORM THE SIMILAR QUERIES FROM SQLPLUS...
    SQL> SELECT * FROM STUDENT WHERE FIRST_NAME='1498671f';
    ID FIRST_NAME LAST_NAME
    1498663 1498671f 1498665l
    Elapsed: 00:00:00.15
    Can anyone please explain me why query in timesten taking more time
    that query in oracle database.
    Message was edited by: Dipesh Majumdar
    user542575
    Message was edited by:
    user542575

    TimesTen
    Hardware: Windows Server 2003 R2 Enterprise x64; 8 x Dual-core AMD 8216 2.41GHz processors; 32 GB RAM
    Version: 7.0.4.0.0 64 bit
    Schema:
    create usermanaged cache group factCache from
    MV_US_DATAMART
    ORDER_DATE               DATE,
    IF_SYSTEM               VARCHAR2(32) NOT NULL,
    GROUPING_ID                TT_BIGINT,
    TIME_DIM_ID               TT_INTEGER NOT NULL,
    BUSINESS_DIM_ID          TT_INTEGER NOT NULL,
    ACCOUNT_DIM_ID               TT_INTEGER NOT NULL,
    ORDERTYPE_DIM_ID          TT_INTEGER NOT NULL,
    INSTR_DIM_ID               TT_INTEGER NOT NULL,
    EXECUTION_DIM_ID          TT_INTEGER NOT NULL,
    EXEC_EXCHANGE_DIM_ID TT_INTEGER NOT NULL,
    NO_ORDERS               TT_BIGINT,
    FILLED_QUANTITY          TT_BIGINT,
    CNT_FILLED_QUANTITY          TT_BIGINT,
    QUANTITY               TT_BIGINT,
    CNT_QUANTITY               TT_BIGINT,
    COMMISSION               BINARY_FLOAT,
    CNT_COMMISSION               TT_BIGINT,
    FILLS_NUMBER               TT_BIGINT,
    CNT_FILLS_NUMBER          TT_BIGINT,
    AGGRESSIVE_FILLS          TT_BIGINT,
    CNT_AGGRESSIVE_FILLS          TT_BIGINT,
    NOTIONAL               BINARY_FLOAT,
    CNT_NOTIONAL               TT_BIGINT,
    TOTAL_PRICE               BINARY_FLOAT,
    CNT_TOTAL_PRICE          TT_BIGINT,
    CANCELLED_ORDERS_COUNT          TT_BIGINT,
    CNT_CANCELLED_ORDERS_COUNT     TT_BIGINT,
    ROUTED_ORDERS_NO          TT_BIGINT,
    CNT_ROUTED_ORDERS_NO          TT_BIGINT,
    ROUTED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_ROUTED_LIQUIDITY_QTY     TT_BIGINT,
    REMOVED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_REMOVED_LIQUIDITY_QTY     TT_BIGINT,
    ADDED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_ADDED_LIQUIDITY_QTY     TT_BIGINT,
    AGENT_CHARGES               BINARY_FLOAT,
    CNT_AGENT_CHARGES          TT_BIGINT,
    CLEARING_CHARGES          BINARY_FLOAT,
    CNT_CLEARING_CHARGES          TT_BIGINT,
    EXECUTION_CHARGES          BINARY_FLOAT,
    CNT_EXECUTION_CHARGES          TT_BIGINT,
    TRANSACTION_CHARGES          BINARY_FLOAT,
    CNT_TRANSACTION_CHARGES     TT_BIGINT,
    ORDER_MANAGEMENT          BINARY_FLOAT,
    CNT_ORDER_MANAGEMENT          TT_BIGINT,
    SETTLEMENT_CHARGES          BINARY_FLOAT,
    CNT_SETTLEMENT_CHARGES          TT_BIGINT,
    RECOVERED_AGENT          BINARY_FLOAT,
    CNT_RECOVERED_AGENT          TT_BIGINT,
    RECOVERED_CLEARING          BINARY_FLOAT,
    CNT_RECOVERED_CLEARING          TT_BIGINT,
    RECOVERED_EXECUTION          BINARY_FLOAT,
    CNT_RECOVERED_EXECUTION     TT_BIGINT,
    RECOVERED_TRANSACTION          BINARY_FLOAT,
    CNT_RECOVERED_TRANSACTION     TT_BIGINT,
    RECOVERED_ORD_MGT          BINARY_FLOAT,
    CNT_RECOVERED_ORD_MGT          TT_BIGINT,
    RECOVERED_SETTLEMENT          BINARY_FLOAT,
    CNT_RECOVERED_SETTLEMENT     TT_BIGINT,
    CLIENT_AGENT               BINARY_FLOAT,
    CNT_CLIENT_AGENT          TT_BIGINT,
    CLIENT_ORDER_MGT          BINARY_FLOAT,
    CNT_CLIENT_ORDER_MGT          TT_BIGINT,
    CLIENT_EXEC               BINARY_FLOAT,
    CNT_CLIENT_EXEC          TT_BIGINT,
    CLIENT_TRANS               BINARY_FLOAT,
    CNT_CLIENT_TRANS          TT_BIGINT,
    CLIENT_CLEARING          BINARY_FLOAT,
    CNT_CLIENT_CLEARING          TT_BIGINT,
    CLIENT_SETTLE               BINARY_FLOAT,
    CNT_CLIENT_SETTLE          TT_BIGINT,
    CHARGEABLE_TAXES          BINARY_FLOAT,
    CNT_CHARGEABLE_TAXES          TT_BIGINT,
    VENDOR_CHARGE               BINARY_FLOAT,
    CNT_VENDOR_CHARGE          TT_BIGINT,
    ROUTING_CHARGES          BINARY_FLOAT,
    CNT_ROUTING_CHARGES          TT_BIGINT,
    RECOVERED_ROUTING          BINARY_FLOAT,
    CNT_RECOVERED_ROUTING          TT_BIGINT,
    CLIENT_ROUTING               BINARY_FLOAT,
    CNT_CLIENT_ROUTING          TT_BIGINT,
    TICKET_CHARGES               BINARY_FLOAT,
    CNT_TICKET_CHARGES          TT_BIGINT,
    RECOVERED_TICKET_CHARGES     BINARY_FLOAT,
    CNT_RECOVERED_TICKET_CHARGES     TT_BIGINT,
    PRIMARY KEY(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID, INSTR_DIM_ID, EXECUTION_DIM_ID,EXEC_EXCHANGE_DIM_ID),
    READONLY);
    No of rows: 2228558
    Config:
    < CkptFrequency, 600 >
    < CkptLogVolume, 0 >
    < CkptRate, 0 >
    < ConnectionCharacterSet, US7ASCII >
    < ConnectionName, tt_us_dma >
    < Connections, 64 >
    < DataBaseCharacterSet, AL32UTF8 >
    < DataStore, e:\andrew\datacache\usDMA >
    < DurableCommits, 0 >
    < GroupRestrict, <NULL> >
    < LockLevel, 0 >
    < LockWait, 10 >
    < LogBuffSize, 65536 >
    < LogDir, e:\andrew\datacache\ >
    < LogFileSize, 64 >
    < LogFlushMethod, 1 >
    < LogPurge, 0 >
    < Logging, 1 >
    < MemoryLock, 0 >
    < NLS_LENGTH_SEMANTICS, BYTE >
    < NLS_NCHAR_CONV_EXCP, 0 >
    < NLS_SORT, BINARY >
    < OracleID, NYCATP1 >
    < PassThrough, 0 >
    < PermSize, 4000 >
    < PermWarnThreshold, 90 >
    < PrivateCommands, 0 >
    < Preallocate, 0 >
    < QueryThreshold, 0 >
    < RACCallback, 0 >
    < SQLQueryTimeout, 0 >
    < TempSize, 514 >
    < TempWarnThreshold, 90 >
    < Temporary, 1 >
    < TransparentLoad, 0 >
    < TypeMode, 0 >
    < UID, OS_OWNER >
    ORACLE:
    Hardware: Sunos 5.10; 24x1.8Ghz (unsure of type); 82 GB RAM
    Version 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    Schema:
    CREATE MATERIALIZED VIEW OS_OWNER.MV_US_DATAMART
    TABLESPACE TS_OS
    PARTITION BY RANGE (ORDER_DATE)
    PARTITION MV_US_DATAMART_MINVAL VALUES LESS THAN (TO_DATE(' 2007-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D1 VALUES LESS THAN (TO_DATE(' 2007-11-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D2 VALUES LESS THAN (TO_DATE(' 2007-11-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D3 VALUES LESS THAN (TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D1 VALUES LESS THAN (TO_DATE(' 2007-12-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D2 VALUES LESS THAN (TO_DATE(' 2007-12-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D3 VALUES LESS THAN (TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D1 VALUES LESS THAN (TO_DATE(' 2008-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D2 VALUES LESS THAN (TO_DATE(' 2008-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D3 VALUES LESS THAN (TO_DATE(' 2008-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_MAXVAL VALUES LESS THAN (MAXVALUE)
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS
    NOCACHE
    NOCOMPRESS
    NOPARALLEL
    BUILD DEFERRED
    USING INDEX
    TABLESPACE TS_OS_INDEX
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    ENABLE QUERY REWRITE
    AS
    SELECT order_date, if_system,
    GROUPING_ID (order_date,
    if_system,
    business_dim_id,
    time_dim_id,
    account_dim_id,
    ordertype_dim_id,
    instr_dim_id,
    execution_dim_id,
    exec_exchange_dim_id
    ) GROUPING_ID,
    /* ============ DIMENSIONS ============ */
    time_dim_id, business_dim_id, account_dim_id, ordertype_dim_id,
    instr_dim_id, execution_dim_id, exec_exchange_dim_id,
    /* ============ MEASURES ============ */
    -- o.FX_RATE /* FX_RATE */,
    COUNT (*) no_orders,
    -- SUM(NO_ORDERS) NO_ORDERS,
    -- COUNT(NO_ORDERS) CNT_NO_ORDERS,
    SUM (filled_quantity) filled_quantity,
    COUNT (filled_quantity) cnt_filled_quantity, SUM (quantity) quantity,
    COUNT (quantity) cnt_quantity, SUM (commission) commission,
    COUNT (commission) cnt_commission, SUM (fills_number) fills_number,
    COUNT (fills_number) cnt_fills_number,
    SUM (aggressive_fills) aggressive_fills,
    COUNT (aggressive_fills) cnt_aggressive_fills,
    SUM (fx_rate * filled_quantity * average_price) notional,
    COUNT (fx_rate * filled_quantity * average_price) cnt_notional,
    SUM (fx_rate * fills_number * average_price) total_price,
    COUNT (fx_rate * fills_number * average_price) cnt_total_price,
    SUM (CASE
    WHEN order_status = 'C'
    THEN 1
    ELSE 0
    END) cancelled_orders_count,
    COUNT (CASE
    WHEN order_status = 'C'
    THEN 1
    ELSE 0
    END
    ) cnt_cancelled_orders_count,
    -- SUM(t.FX_RATE*t.NO_FILLS*t.AVG_PRICE) AVERAGE_PRICE,
    -- SUM(FILLS_NUMBER*AVERAGE_PRICE) STAGING_AVERAGE_PRICE,
    -- COUNT(FILLS_NUMBER*AVERAGE_PRICE) CNT_STAGING_AVERAGE_PRICE,
    SUM (routed_orders_no) routed_orders_no,
    COUNT (routed_orders_no) cnt_routed_orders_no,
    SUM (routed_liquidity_qty) routed_liquidity_qty,
    COUNT (routed_liquidity_qty) cnt_routed_liquidity_qty,
    SUM (removed_liquidity_qty) removed_liquidity_qty,
    COUNT (removed_liquidity_qty) cnt_removed_liquidity_qty,
    SUM (added_liquidity_qty) added_liquidity_qty,
    COUNT (added_liquidity_qty) cnt_added_liquidity_qty,
    SUM (agent_charges) agent_charges,
    COUNT (agent_charges) cnt_agent_charges,
    SUM (clearing_charges) clearing_charges,
    COUNT (clearing_charges) cnt_clearing_charges,
    SUM (execution_charges) execution_charges,
    COUNT (execution_charges) cnt_execution_charges,
    SUM (transaction_charges) transaction_charges,
    COUNT (transaction_charges) cnt_transaction_charges,
    SUM (order_management) order_management,
    COUNT (order_management) cnt_order_management,
    SUM (settlement_charges) settlement_charges,
    COUNT (settlement_charges) cnt_settlement_charges,
    SUM (recovered_agent) recovered_agent,
    COUNT (recovered_agent) cnt_recovered_agent,
    SUM (recovered_clearing) recovered_clearing,
    COUNT (recovered_clearing) cnt_recovered_clearing,
    SUM (recovered_execution) recovered_execution,
    COUNT (recovered_execution) cnt_recovered_execution,
    SUM (recovered_transaction) recovered_transaction,
    COUNT (recovered_transaction) cnt_recovered_transaction,
    SUM (recovered_ord_mgt) recovered_ord_mgt,
    COUNT (recovered_ord_mgt) cnt_recovered_ord_mgt,
    SUM (recovered_settlement) recovered_settlement,
    COUNT (recovered_settlement) cnt_recovered_settlement,
    SUM (client_agent) client_agent,
    COUNT (client_agent) cnt_client_agent,
    SUM (client_order_mgt) client_order_mgt,
    COUNT (client_order_mgt) cnt_client_order_mgt,
    SUM (client_exec) client_exec, COUNT (client_exec) cnt_client_exec,
    SUM (client_trans) client_trans,
    COUNT (client_trans) cnt_client_trans,
    SUM (client_clearing) client_clearing,
    COUNT (client_clearing) cnt_client_clearing,
    SUM (client_settle) client_settle,
    COUNT (client_settle) cnt_client_settle,
    SUM (chargeable_taxes) chargeable_taxes,
    COUNT (chargeable_taxes) cnt_chargeable_taxes,
    SUM (vendor_charge) vendor_charge,
    COUNT (vendor_charge) cnt_vendor_charge,
    SUM (routing_charges) routing_charges,
    COUNT (routing_charges) cnt_routing_charges,
    SUM (recovered_routing) recovered_routing,
    COUNT (recovered_routing) cnt_recovered_routing,
    SUM (client_routing) client_routing,
    COUNT (client_routing) cnt_client_routing,
    SUM (ticket_charges) ticket_charges,
    COUNT (ticket_charges) cnt_ticket_charges,
    SUM (recovered_ticket_charges) recovered_ticket_charges,
    COUNT (recovered_ticket_charges) cnt_recovered_ticket_charges
    FROM us_datamart_raw
    GROUP BY order_date,
    if_system,
    business_dim_id,
    time_dim_id,
    account_dim_id,
    ordertype_dim_id,
    instr_dim_id,
    execution_dim_id,
    exec_exchange_dim_id;
    -- Note: Index I_SNAP$_MV_US_DATAMART will be created automatically
    -- by Oracle with the associated materialized view.
    CREATE UNIQUE INDEX OS_OWNER.MV_US_DATAMART_UDX ON OS_OWNER.MV_US_DATAMART
    (ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID,
    INSTR_DIM_ID, EXECUTION_DIM_ID, EXEC_EXCHANGE_DIM_ID)
    NOLOGGING
    NOPARALLEL
    COMPRESS 7;
    No of rows: 2228558
    The query (taken Mondrian) I run against each of them is:
    select sum("MV_US_DATAMART"."NOTIONAL") as "m0"
    --, sum("MV_US_DATAMART"."FILLED_QUANTITY") as "m1"
    --, sum("MV_US_DATAMART"."AGENT_CHARGES") as "m2"
    --, sum("MV_US_DATAMART"."CLEARING_CHARGES") as "m3"
    --, sum("MV_US_DATAMART"."EXECUTION_CHARGES") as "m4"
    --, sum("MV_US_DATAMART"."TRANSACTION_CHARGES") as "m5"
    --, sum("MV_US_DATAMART"."ROUTING_CHARGES") as "m6"
    --, sum("MV_US_DATAMART"."ORDER_MANAGEMENT") as "m7"
    --, sum("MV_US_DATAMART"."SETTLEMENT_CHARGES") as "m8"
    --, sum("MV_US_DATAMART"."COMMISSION") as "m9"
    --, sum("MV_US_DATAMART"."RECOVERED_AGENT") as "m10"
    --, sum("MV_US_DATAMART"."RECOVERED_CLEARING") as "m11"
    --,sum("MV_US_DATAMART"."RECOVERED_EXECUTION") as "m12"
    --,sum("MV_US_DATAMART"."RECOVERED_TRANSACTION") as "m13"
    --, sum("MV_US_DATAMART"."RECOVERED_ROUTING") as "m14"
    --, sum("MV_US_DATAMART"."RECOVERED_ORD_MGT") as "m15"
    --, sum("MV_US_DATAMART"."RECOVERED_SETTLEMENT") as "m16"
    --, sum("MV_US_DATAMART"."RECOVERED_TICKET_CHARGES") as "m17"
    --,sum("MV_US_DATAMART"."TICKET_CHARGES") as "m18"
    --, sum("MV_US_DATAMART"."VENDOR_CHARGE") as "m19"
              from "OS_OWNER"."MV_US_DATAMART" "MV_US_DATAMART"
    where I uncomment a column at a time and rerun. I improved the TimesTen results since my first post, by retyping the NUMBER columns to BINARY_FLOAT. The results I got were:
    No Columns     ORACLE     TimesTen     
    1     1.05     0.94     
    2     1.07     1.47     
    3     2.04     1.8     
    4     2.06     2.08     
    5     2.09     2.4     
    6     3.01     2.67     
    7     4.02     3.06     
    8     4.03     3.37     
    9     4.04     3.62     
    10     4.06     4.02     
    11     4.08     4.31     
    12     4.09     4.61     
    13     5.01     4.76     
    14     5.02     5.06     
    15     5.04     5.25     
    16     5.05     5.48     
    17     5.08     5.84     
    18     6     6.21     
    19     6.02     6.34     
    20     6.04     6.75

  • Frm-40505:ORACLE error: unable to perform query in oracle forms 10g

    Hi,
    I get error frm-40505:ORACLE error: unable to perform query on oracle form in 10g environment, but the same form works properly in 6i.
    Please let me know what do i need to do to correct this problem.
    Regards,
    Priya

    Hi everyone,
    I have block created on view V_LE_USID_1L (which gives the error frm-40505) . We don't need any updation on this block, so the property 'updateallowed' is set to 'NO'.
    To fix this error I modified 'Keymode' property, set it to 'updatable' from 'automatic'. This change solved the problem with frm-40505 but it leads one more problem.
    The datablock v_le_usid_1l allows user to enter the text (i.e. updated the field), when the data is saved, no message is shown. When the data is refreshed on the screen, the change done previously on the block will not be seen (this is because the block updateallowed is set to NO), how do we stop the fields of the block being editable?
    We don't want to go ahead with this solution as, we might find several similar screens nad its diff to modify each one of them individually. When they work properly in 6i, what it doesn't in 10g? does it require any registry setting?
    Regards,
    Priya

  • MS Access Query to Oracle

    Hi Gurus
    I am trying to convert a MS Access query to Oracle query, Having some trouble Need some help Please.
    This is the MS Access Query:
    Sum(IIf(LOAD1!ARRIVDATE<+Date()+7,LOADLINE1!QTY,0)/ITEM1!UOM) AS Loadtbl
    What would be the Oracle Query???
    Thank you

    Hello,
    well, the problem is the name of the column, ARRIVDATE< - while MS Access allows the "<" inside a column name, Oracle doesn't if you don't be careful. Please see this:
    SQL> create table testtab1 (arrivdate varchar2(100));
    Table created.
    SQL> desc testtab1
    Name Null? Type
    ARRIVDATE VARCHAR2(100)
    SQL> create table testtab2 (arrivdate< varchar2(100));
    create table testtab2 (arrivdate< varchar2(100))
    ERROR at line 1:
    ORA-00902: invalid datatype
    But this works:
    SQL> create table testtab2("ARRIVDATE<" varchar2(100));
    Table created.
    SQL> desc testtab2
    Name Null? Type
    ARRIVDATE< VARCHAR2(100)
    So your query might work if you put ARRIVDATE< in double quotes:
    Sum(DECODE(LOAD1."ARRIVDATE<"+SYSDATE+7,LOADLINE1.QTY,0)/ITEM1.UOM) AS Loadtbl
    Regards
    Wolfgang
    Edited by: wkobargs on Aug 8, 2012 7:51 AM
    Edited by: wkobargs on Aug 8, 2012 7:59 AM
    Edited by: wkobargs on Aug 8, 2012 8:00 AM

  • Spatial Query that uses Result of another Spatial Query

    Hi all,
    I am using the SDO_DIFFERENCE Operator to return the difference between a query window and an intersection geometry. This is fine and i get an object back that is cast to a STRUCT using the SDO API. I want then to use this (returned)object in another SQL query that uses the SDO_RELATE Operator. The problem is that i dont know what type it needs to be so that the SDO_RELATE operator will accept it as a valid argument. Has anyone done this before or seen anything like it? Any help will be very much appreciated.
    Keith.

    Thanks for your help,
    I have done the following steps, but i still dont understand why it doesnt work.
    CREATE TABLE val_results (sdo_rowid ROWID, result varchar2(1000));
    CALL SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT('SHAPES','SHAPE','VAL_RESULTS');
    SELECT * FROM val_results;
    1 null     Rows Processed <3>
    2 AAARDDAAEAAAAA+AAA     13348 [Element <1>] [Ring <1>]
    3 AAARDDAAEAAAAA+AAB     13367 [Element <1>] [Ring <1>]
    SELECT shape_id,SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(c.shape, 0.005)
    FROM shapes c;
    3     TRUE
    2     13348 [Element <1>] [Ring <1>]
    1     13367 [Element <1>] [Ring <1>]
    If my rectangle and polygon is still invalid, can someone tell me why they are invalid. And how can i make them valid?
    Thanks.
    UPDATE:
    I have solved Polygon issue.
    In Spatial Developer's Guide it says:
    Simple polygon whose vertices are connected by straight line
    segments. You must specify a point for each vertex; and the
    last point specified must be exactly the same point as the first
    (within the tolerance value), to close the polygon. For
    example, for a 4-sided polygon, specify 5 points, with point 5
    the same as point 1.
    I have added a point to polygon which is same as first point. Now, it can find the point in polygon.
    INSERT INTO shapes VALUES (4, 'Polygon', SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,1), SDO_ORDINATE_ARRAY(306,193,130,441,489,653,88,183,442,354,306,193)));
    But, when i run this query again:
    SELECT shape_id,SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(c.shape, 0.005) FROM shapes c;
    4     13349 [Element <1>] [Ring <1>][Edge <4>][Edge <1>]
    3     TRUE
    2     13348 [Element <1>] [Ring <1>]
    1     13367 [Element <1>] [Ring <1>]
    it doesn't say TRUE like it did for Circle ??
    Edited by: WhiteScars on Jan 4, 2010 12:45 AM

  • For Update Query from ORACLE Forms

    Hi
    We are using Oracle Forms 10g running with 10g database 10.2.0.1.0. We happend to see a query which is getting generated in AWR report like Select rowid, all_columns from TableName for Update of C1 Nowait. But no such query is really written in forms and we are aware that, Any query prefixed with rowid is definitely executing from Forms. But how the ForUpdate and Nowait clause is appended to the query.
    We have checked the following properties in the database Block
    *1) Locking Mode is set to Automatic*
    *2) Update Changed Columns only is set to YES*
    *3) Query all records is set to No (Though this particular property may not be relevant to the issue)*
    What is the property or setting which might trigger such a query from ORACLE Forms with ForUpdate and Nowait clause.
    Any ideas/suggestions on why such behaviour. Please have a healthy discussion on this. Thanks in advance.

    you can't dynamically add a query to the data model in reports.
    You should look into the XML based customization of Oracle Reports. This will enable you to define a report dynamically by creating a definition in XML.
    Also another option is to have the report with a query in it and use lexical parameters in reports to pass the query definition or just the where part of it.
    Look at the reports online help for both of these solutions.

  • Converting MS SQL Server Query to Oracle Query

    Hi There,
    I've a strange problem. My project uses both MS SQL Server and Oracle server at run time. I've lot of queries which are written in MS SQL Style. Now, iam planning to write a helper class whic converts MS SQL Query to Oracle Query. Please Help me if any one has that kind of Helper with you.
    Thanks And Regards,
    Sasi Kanth

    That is why persistence applications like Hibernate or
    CMP get used for apps that will use more than one DB,
    but it takes upfront planning.
    If you have a set of automated unit tests that work
    with SQL Server, they will be a big help in getting
    your Oracle code up and running.Indeed - JUnit and Ant would be a big help here.
    It sounds like you have SQL in your JSPs, that will
    work against you as well if so. If you are using a
    DAO pattern, this will be much easier, as you can
    re-implement each DAO for Oracle.If you'd layered this app properly, you might just implement an OracleDAOFactory and be done with it. Interfaces and a DAO layer would go a long way.
    This is why layering is such a good idea. It isolates changes in a smaller subset of classes.
    But your problem sounds pretty big. It'd be daunting even if it were well designed.

  • Problem in using Oracle BPEL 10.1.2 (beta3) Worklist API

    I'm trying the following simple program but fails. Thanks advance for your help. Here are the codes:
    package test;
    import oracle.tip.pc.api.worklist.IWorklistContext;
    import oracle.tip.pc.infra.exception.PCException;
    import oracle.tip.pc.services.hw.worklist.WorklistService;
    public class TaskTester
    public static void main(String[] args)
    String username="jcooper";
    String password="welcome";
    try
    WorklistService worklistService = WorklistService.getWorklistService();
    IWorklistContext ctx = worklistService.authenticateUser(username,password);
    System.out.println("Success");
    catch (PCException pce)
    pce.printStackTrace();
    System.out.println(pce.toString());
    The following error message is resulted:
    log4j:WARN No appenders could be found for logger (collaxa.cube.services).
    log4j:WARN Please initialize the log4j system properly.
    Warning: Could not locate file pc.properties in classpath
    java.lang.NullPointerException
    at oracle.tip.pc.services.hw.worklist.WorklistService.authenticateUser(WorklistService.java:272)
    at test.TaskTester.main(TaskTester.java:17)
    ORABPEL-10142
    Worklist Service Authenticate User Error.
    An error occured in the Worklist Service while authenticating user jcooper with the identity service.
    Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.

    It works fine after I port it to a web service. But, there's another problem when I try to call "getWorklistTasks" after "authenticateUser" and the codes are as follows:
    IWorklistContext ctx = worklistService.authenticateUser(userName,password);
    Map filterMap = new HashMap();
    filterMap.put("TaskFilter", "My & Group");
    filterMap.put("PriorityFilter", "Any");
    filterMap.put("StatusFilter", "Assigned");
    filterMap.put("BusinessProcessFilter", "Any");
    List taskList = worklistService.getWorklistTasks(ctx, "", filterMap, "Title", "ASC");
    It resulted that after calling "getWorklistTasks", it hanged and no reply.
    Any idea? Thanks a lot.
    Best Regards,
    Simon.

  • ......Another Import Issue in ORacle...URGENT PLZ!!!!!!!

    HI all
    i have comeup with another problem.SOrry for disturbing gentlemen but i feel thats how we all learn.
    MY Client has a request Form in MSWORD. He wants me to give him functionality that he fills the Form in MSWORD and clicks the button and the request automatically fills in the database.
    THE WORD document contains fields like
    Parameter name, oldvalue ,current value etc..
    WE can define a table in the database according to the request form
    but how to allow user to read from a text/word file and update in the database
    Your kind input will be helpful
    thnx alot

    What you are trying to do is no small task.
    Creating the table is the easy part.
    You can look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_vsto2003_tr/html/odc_VSTMGBLab6.asp
    for an example.
    You do not really need the XML part, once the user has pressed the button to commit the form you could just initiate an insert.
    Is there no way to make them fill in an oracle form instead of a word doc?

  • Problem Querying "Col" View

    Hello guys,
    I have some problem querying the "Col" View of Sys.
    I have tested the following scenarios:
    C# Code:
    using (OracleConnection con = new OracleConnection("MyConnection"))
    con.Open();
    using (OracleDataReader reader = new OracleCommand("SELECT * from Col", con).ExecuteReader())
    while (reader.Read())
    Console.WriteLine(String.Format("Default Value: {0}",Convert.ToString(reader["DEFAULTVAL")));
    If I tested this code using System.Data.OracleClient It works Fine and if there is sopme default Value it would be written.
    If I change the driver using Oracle.DataAccess.dll from the last release.
    Always, depite exists the DefaultValue it through "".
    If I execute the query from TOAD I get the correct value also.
    If I Change the code to use a OracleDataAdapter (:() I get an exception of Long Data Type.
    My Oracle DB info is:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    VS version is VS2010
    Any workAround?
    Regards!
    Edited by: JTorrecilla on 25-ene-2012 7:09
    Edited by: JTorrecilla on 25-ene-2012 7:16

    Finally, I get solved:
    I need to add "InitialLONGFetchSize= -1" to the command configuration.

Maybe you are looking for

  • ERROR OCCURRED WHILE VIEWING A WEBI REPORT

    when i'm trying to refresh a WEBI report, I'm getting this error. Can anyone please help me with it? Here is the snapshot of the error: Thanks! Neha.

  • I want an older version of iTunes.

    does anyone know where to find the earlier versions? seriously, iTunes 7.0 drove me crazy enough that i uninstalled it, because it kept losing the file paths to my library, and i kept having to go and re-find all of the songs every day or two. doing

  • Updating button icon issue

    Hi, thanks for stopping by. Working with scriptUI panel and trying to update icon for my button, but something goes wrong with my code, I guess... Can someone write what is the problem here? var mainPanel; function stabpanel(thisObj) {     mainPanel

  • Dual Operating Systems

    I know that you can use a program such as Parallels to run Windows on an Intel-based Mac. My question: is it possible to run the configuration in the opposite direction, i.e. install OSX Lion on an Intel-based Windows laptop? If so, what software is

  • DRM Doesn't Work on LULU - Can I apply it directly myself?

    LULU.com used Adobe Digital Editions to apply DRM.  I have large file of 187 MB and for some reason, on their system it will not apply DRM.  It just hangs. Can I apply it directly myself somehow and then upload my book to LULU?