Running the same query against numerous databases

My organization has 20+ clients. Each client has a separate database in the same MSSQL server*. For these purposes, the databases are structurally identical. I've been tasked to gather information from tables in all of these databases. I can use the same query on multiple clients - my issue is switching between databases.
The naive solution would be for me to declare 20+ DataSource instances, and have some mapping from client name to DataSource. I think that's going to be a real mess and my inclination is to avoid it.
Another possibility would be dynamically generating the PreparedStatement based on the client, something like
"SELECT foo, bar " + "FROM " + client.getDatabaseName() + ".dbo.my_table";
My understanding, though, is that it's a bad practice to have dynamically generated prepared statement calls and not possible to parameterize the 'from' clause.
Another thing I've been digging around at is using a transaction and an SQL Server call to alter what database calls from that transaction go to. I thought that could be done, but I'm not finding anything which suggests it's possible.
I guess I've identified my problem, but I'm thrashing on how to solve it. I'm still newish to non-trivial database interactions, so I'd appreciate any input. If I posted this in the wrong place, please feel free to yell at me and move it.
Thanks in advance,
Eric
* Not my fault. I'm new.

I'm collection usage and storage metrics. "Client X has 200 records, Client Y has 250. Client X has 15 active users, Client Y has 12."
The data is being read from the client databases and stored into a separate metrics database.
I anticipate it will be mostly select count() calls.
I can. For the maintenance reasons I mentioned above, I'd rather not have to maintain all those datasources if I don't have to.
No, the invocations will be sequential.
for (each metric type) {
    for (each client) {
        gather information;
        add to batch
    update batch in metrics database
}I guess I was hoping there was a Sekrit SQL way to swap what database inside a server instance the connection was pointing to. I'm guessing that's not going to happen, and I'm left with N datasources for N clients or generated preparedStatements which swap out the database name in the FROM portion.
The data is being written to a table in a single, separate metrics database.
I'm trying not to, honest.
Edited by: 919852 on Mar 12, 2012 8:38 AM

Similar Messages

  • Need to run the same query on different databases with the same argument

    Hi folks,
    I've a script: obj, which has simple stuff, when I execute @obj
    this asked me for the object_name
    and in return gives me object/s if it exists in this (connected) db.
    Now to check in 2 other dbs, I've to disconnect from here and then connect to those dbs and run the same @obj there and give the same argument, e.g., EMP and it'll return the answer.
    What is desired ... if not very hard on you :-(
    Some thing like @objAll
    asked only once object_name ... e.g., I gave EMP
    now go to all the 3 dbs and give me the result in ONE spool file only.
    What do you think, is this tough, I did something, but it was not involved connecting to different dbs, within the same script, but here we cannot create db links and have to disconnect and connect to the db to get some information.
    Please do reply, if my question is not understandable or any ...
    Thanks in advance.
    Best regards.
    Edited by: user8604530 on Jun 27, 2012 1:51 PM

    As far as i understand from your question : you cannot create db links ? right..
    well another option is to create a shell script , something like this :
    vi check.sh
    export ORACLE_SID=db1
    sqlplus / as sysdba <<EOF
    select query comes here;
    exit;
    EOF
    export ORACLE_SID=db2
    sqlplus / as sysdba <<EOF
    select query comes here;
    exit;
    EOFchmod 777 check.sh
    This does the job for you.. I am unsure how to pass the parameters in sql while running through a sheel script.. but if thats possible you will be able to achieve what you want.
    Regards
    Kk
    Edited by: Kk on Jun 27, 2012 2:44 PM

  • Same the same query against all the schemas

    Hi all,I am a newbie to databases
    I have a requirement where in in need to run the same query against all the schema s in the database.what would be the best way to do it.other than logging into each user and running query.Its a complex query I can't do a direct select  from sys or other even for I will have to change a lot of things.Is there a easier way to do it ??
    Thanks in advance

    990051 wrote:
    Hi all,I am a newbie to databases
    I have a requirement where in in need to run the same query against all the schema s in the database.what would be the best way to do it.other than logging into each user and running query.Its a complex query I can't do a direct select  from sys or other even for I will have to change a lot of things.Is there a easier way to do it ??
    Thanks in advance
    you have a choice between logging into each user & running the SQL or you can log into each user & run the SQL.

  • Discoverer doesn't run the same query than TOAD

    Hi,
    I'm trying to make the following in Discoverer version 10.1.2:
    To display some records of a table using a condition and display the total of all of them of the same table. I'm trying to create a custom folder with the following query:
    SELECT PRSTDCLA
    FROM PROVEIDER
    UNION ALL
    WHERE ( PRSTDCLA = 1 )
    SELECT SUM(PRSTDCLA)
    FROM PROVEIDER;
    If I run this query in TOAD, the result is the correct. But when I run it in a Desktop worksheet, the result obtained is one row: the total of the whole table.
    Why Desktop doesn't display the correct result?
    Thanks.

    Every numeric field in Discoverer has a default aggregation method. By default, this is set to sum. When you are creating the query in Discoverer, you need to click on the plus next to PRSTDCLA and select "detail" when you are creating your Discoverer query. Otherwise, it will automatically try and group by the non-aggregated column. In this case, you aren't selecting any other columns, so there aren't any other columns to group by and you get one row.
    In Discoverer admin, you can change the default aggregation method for the PRSTDCLA field so that it displays the details (and does not aggregate by default).
    Also, why put the total in the folder definition? Discoverer can put the Total at the bottom of the table for you. Just create a new "Total".
    Hi,
    I'm trying to make the following in Discoverer
    version 10.1.2:
    To display some records of a table using a condition
    and display the total of all of them of the same
    table. I'm trying to create a custom folder with the
    following query:
    SELECT PRSTDCLA
    FROM PROVEIDER
    UNION ALL
    WHERE ( PRSTDCLA = 1 )
    SELECT SUM(PRSTDCLA)
    FROM PROVEIDER;
    If I run this query in TOAD, the result is the
    correct. But when I run it in a Desktop worksheet,
    the result obtained is one row: the total of the
    whole table.
    Why Desktop doesn't display the correct result?
    Thanks.

  • Running a query in a View Designer results in an error, but running the same query in a Query window works

    Hi everyone,
    Just as my title says, I have a query which I've written in a query window and it works perfectly.
    But when I try to add the query code into the view designer, it throws a Syntax error.
    Error in ON clause near '('.Unable to parse query text.
    Also, when running the query from the view designer (pressing red exclamation mark) I get a different error.
    SQL Execution Error.Executed SQL statement: SELECT Sku, ParentSku, UPC, ...Error Source: .Net SqlClient Data ProviderError Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
    Has anyone else experienced this and is there any workaround?
    I have tried to create the view with T-SQL (CREATE VIEW etc.), but when opening it in the view designer I get the error from the 1st image.
    Thank you,
    Radu

    Hi Radu,
    Yes, I have faced similar issue. I had a View and it was working totally fine but when once I opened it in via right click - View Design, it was giving parse error.
    Cause is that Query designer parse and executes the query without error but the way View designer works, it can't parse it.
    Later I ignored View desinger and just used T-SQL like CREATE/ALTER view.
    Workaround is to do right click on View - Script View as - CREATE To/ ATER To.
    Regarding Timeout error, again the issue with View designer which couldn't execute query in there and ended up with timeout error.
    If your SELECT query and SELECT * FROM YourView works fine in Query designer, you are good to go.
    Similar threads:
    View with errors still saved, and still works...
    Parsing error when creating view
    -Vaibhav Chaudhari

  • Running the same application in different database table- giving error:

    Hi All,
    I m new to JSF, spring and Hibernate web application. I have done a web project using JSF, Hibernate and Spring. We have to maintain the Data records which is stored in mysql db. Now there are different table is there such as example Employee Details and Company Details. So we created two seperate application o tomacat, For both Application we use same functionality except the JSP FILE Name and table name (Which is changed according to Application).
    In the employee.hbm.xml
    I changed the table name according to application. Two table (Company Details & Employee Details)...
    Now while running the application on the tomcat server, only one application is running at a time. if we start running the Employee Application, then Company Application is giving the below error,
    Error in Log:
    The resourse is already in used/busy.
    Interesting thing is only one Application is running at a time and other is in stop status.
    Could you please help us, how to overcome the error,
    Is it not possible to run both the application on different browsers.
    In logs the below error is showing:
    java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
    Could you please give some idea to sort out the below issue.
    Thanks in advance.

    Yes, I've changed the DynamicJDBCBindingFilter Class in this way:
    method doFiletr
    String usrName = request.getParameter(USERNAME_PARAM);
    String pswd = request.getParameter(PASSWORD_PARAM);
    String URL = request.getParameter(URL_PARAM);
    session.setAttribute(Configuration.DB_USERNAME_PROPERTY, usrName);
    session.setAttribute(Configuration.DB_PASSWORD_PROPERTY, pswd);
    session.setAttribute(Configuration.DB_CONNECT_STRING_PROPERTY,URL);//
    This is for retrieve the JDBC URL from the login page
    Then i've modified the DynamicJDBCEnvInfoProvider to accept this new parameter
    if(mJDBCURL!=null)
    ((Hashtable) connEnvironment).put(Configuration.DB_CONNECT_STRING_PROPERTY,mJDBCURL);
    Finally i modifed the DynamicJDBCSessionCookieFactory
    tho put this new parameter in DynamicJDBCEnvInfoProvider class
    EnvInfoProvider provider = new DynamicJDBCEnvInfoProvider(
    (String)session.getAttribute(Configuration.DB_USERNAME_PROPERTY),
    (String)session.getAttribute(Configuration.DB_PASSWORD_PROPERTY),
    (String)session.getAttribute[b](Configuration.DB_CONNECT_STRING_PROPERTY));
    cookie.setEnvInfoProvider(provider);
    But when I test the application it doesn't works.
    With the correct parameter the login fails.
    I'm not using a DB on my local machine, but one on another machine which has not the Dept table.
    thanks for help

  • Can we Run the same Query on Infocube and ODS?

    Hi all,
    There is an ODS A, Currently Query_ABC is created on the ODS A,
    The InfoObjects available in the ODS A are also available in the INFOCUBE B.
    I want to delete the ODS A, So can we create the Query_ABC on INFOCUBE B.
    If so, should i create the Query from scratch or is there any other way to copy the Query_ABC from ODS A to INFOCUBE B.
    Please provide your valuable suggestions.
    Thanks,
    Sowrabh

    HI,
    Actually, Structures appear to be "Global" only within a specifi InfoProvider. If you are using RSZC then you are copying betwee providers, so I would expect that the copy may be having a problem wit the internal ID's associated to the Cells, which are probably derive based on the ID's of the rows and columns.
    Since the Structures don't exist in the destination, or don't have the sam ID's then these pieces cannot be rebuilt in the copied query.
    You could try this to get around having to rebuild:
    1) In your source query make a copy in the same provider and remove the Ro and/or Column Named structure references (you don't delete the structure just make the query so it doesn't reference it). You do this b right-clicking on the structure name in the query, and chose the optio 'Remove reference'. This will make your query as if these details wer built directly in the query. Save this revised query.
    2) Copy the revised query to your destination. Since all components wil contain internal ID's without reference to any external component (Structures) it should be able to copy everything.
    You can then re-save the Row and/or Column definitions as structure associated to the destination InfoProvider, if you wish.
    Thanks
    Sreenu

  • When I run the same query for the second time it's faster, I want to reset this behavior

    I am running a query in oracle 11g select A from B where C = ':D' B has millions of records.
    The first time i run it it takes about 30 seconds, the second time i run the query it takes about 1 second.
    Obviously it's caching something and i want it to stop that, each time i run the query i want it to take 30s - just like it was running for the first time.
    The reason I want to reset this is because for testing purposes I want to measure this query at the very first time.
    Please help.
    Thanks & Best Regards,
    Dark

    user9359353 wrote:
    I am running a query in oracle 11g select A from B where C = ':D' B has millions of records.
    The first time i run it it takes about 30 seconds, the second time i run the query it takes about 1 second.
    Obviously it's caching something and i want it to stop that, each time i run the query i want it to take 30s - just like it was running for the first time.
    The reason I want to reset this is because for testing purposes I want to measure this query at the very first time.
    Please help.
    Thanks & Best Regards,
    Dark
    No - you do NOT want to do that. Not if you want to get results that really represent how that query will work in reality.
    See these two AskTom blogs where he discusses the reasons for NOT doing this in detail.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:7413988573867
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:311990400346061304

  • DIfferent perfromance of same query on two database

    We have our DEV database of 11.2.0.2 on Redhat 5.2, and our production database is a two node RAC of the same version on same ype of servers. Recently, we noticed that when run the same query on the two server, the DEV is 300 to 1000 times faster than on production, while the exec plan cost of DEV is one third of that of PRD. The query is SELECT PERSON_X_IDTY.PERSON_ID AS Facet_ID,1.0 AS Facet_Rank
    FROM (IDTY INNER JOIN PERSON_X_IDTY ON ((IDTY.IDTY_ID = PERSON_X_IDTY.IDTY_ID)))
    WHERE (((IDTY.IDTY_NAME_FIRST IS NOT NULL AND LOWER(IDTY.IDTY_NAME_FIRST) = LOWER('DAVID'))
    AND (IDTY.IDTY_NAME_LAST IS NOT NULL AND LOWER(IDTY.IDTY_NAME_LAST) = LOWER('MILLER'))
    AND (IDTY.IDTY_BIRTH_DATE IS NOT NULL
    AND (IDTY.IDTY_BIRTH_DATE BETWEEN TO_DATE('1981-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS')
    AND TO_DATE('2000-12-31 23:59:59','YYYY-MM-DD HH24:MI:SS')))
    AND (IDTY.IDTY_GENDER IS NOT NULL AND IDTY.IDTY_GENDER = 'M'))) AND ROWNUM<= 300 I know the query looks stupid, but that is generated and we are not to change it.
    The exec plan show indexes are used for both table, but cost on PRD are heavier for index RANGE SCAN or BY INDEX ROWID. The index used for table IDTY is a functional index on IDTY.IDTY_NAME_LAST. I rebuild the indexes used but there is no improvement.
    What parameters or configuration of database I need to check to find the reason for this case?
    Thanks.

    Thank you for all your replies. I did found some difference in init parameters and I restarted Oracle on PRD with a parameter file that is most copied from DEV and make the two as the same as possible. Not solve the problem. After noted that both tables involved are set to PARALLEL 4, I did SQL> alter table IDTY parallel 1;
    SQL> alter table PERSON_X_IDTY patallel 1; The query plan got worse, but the query returned in a time comparable with DEV. THen I re-set parallelism back to 4 SQL> alter table IDTY parallel 4;
    SQL> alter table PERSON_X_IDTY patallel 4; Query performance remained being good.
    Now I have a work around, but hope can got an explaination? The parameters related to parallellism areNAME1                           VALUE_PRD                   VALUE_DEV                  
    fast_start_parallel_rollback    LOW                         LOW                        
    parallel_adaptive_multi_user    TRUE                        TRUE                       
    parallel_automatic_tuning       FALSE                       FALSE                      
    parallel_degree_limit           CPU                         CPU                        
    parallel_degree_policy          MANUAL                      MANUAL                     
    parallel_execution_message_size 16384                       16384                      
    parallel_force_local            FALSE                       FALSE                      
    parallel_io_cap_enabled         FALSE                       FALSE                      
    parallel_max_servers            160                         160                        
    parallel_min_percent            0                           0                          
    parallel_min_servers            0                           0                          
    parallel_min_time_threshold     AUTO                        AUTO                       
    parallel_server                 TRUE                        FALSE                      
    parallel_server_instances       2                           1                          
    parallel_servers_target         64                          64                         
    parallel_threads_per_cpu        2                           2                          
    recovery_parallelism            0                           0    

  • Best practice for a same query against 2 different tables

    Hello all,
    I want to extract info about tablespaces storage, both permanent and temporary. For that I use 2 different cursors that do exactly the same query but against a different table (dba_data_files and dba_temp_files).
    CURSOR permanentTBSStorageInfo (tablespaceName VARCHAR2) IS
    SELECT file_name, bytes, autoextensible, maxbytes, increment_by
    FROM dba_data_files
    WHERE tablespace_name = tablespaceName;
    CURSOR temporaryTBSStorageInfo (tablespaceName VARCHAR2) IS
    SELECT file_name, bytes, autoextensible, maxbytes, increment_by
    FROM dba_temp_files
    WHERE tablespace_name = tablespaceName;
    First I'm bothered that I have to use 2 cursors to execute the same query against 2 different tables. Is there no another way around?
    Then I fetch the results of this cursors in 2 different loops because I didn't find a way to dynamically call the cursors. I am looking for best practice here, knowing that I will do the same parsing against the results of the 2 cursors.
    Thank you,

    Hi
    Check whether the below query is helpful or not
    select      fs.tablespace_name "Tablespace",
         fs.tempspace "Temp MB",
         df.totalspace "Total MB"
         from
         (select
         tablespace_name,
         round(sum(bytes) / 1048576) TotalSpace
         from
         dba_data_files
         group by
         tablespace_name
         ) df,
         (select
         tablespace_name,
         round(sum(bytes) / 1048576) tempSpace
         from
         dba_temp_files
         group by
         tablespace_name
         ) fs
         where
         df.tablespace_name = fs.tablespace_name;
    Thanks

  • How to share the same QUERY among report, chart on the same page? and more

    Dear HTMLDB experts,
    I am absolute rookie to this tool, so I have some questions need you all's help.
    (1)
    When I build a page with a spread sheet and a chart on the same page, they all use the same query to get the data. However, I have to type in the SQL twice in spread sheet(report region) and chart's attribute sections. It seems so dumb, does it really run the same query twice, is there a way to share the same query?
    i.e. SELECT name, timestamp, value FROM foo WHERE name = :P1_NAME? (by the way, is :P1_NAME case sensitive?)
    (2)
    In the same chart, if I have two series from two columns of the same table, I have to write 2 queries, one
    select null, timestamp, value1 from same_table
    and
    select null, timestamp, value2 from same_table
    Is it possible to use one query: select timestamp, value1, value2 from same_table and define the series on two value columns of this single query? It's really no point to run two queris.
    (3)
    In a chart, when the query has ORDER by clause, it seems the chart is not showing up.
    So instead of using the query below
    SELECT null, to_char(ts,'mmdd') ts, value
    FROM same_table
    WHERE ts >= TRUNC(SYSDATE) - :P2_DAYSAGO - 1
    AND name = :P1_NAME
    ORDER BY ts
    I have to use a walkaround query
    SELECT null, ts, used
    FROM
    SELECT null, to_char(ts,'mmdd') ts, value
    FROM same_table
    WHERE ts >= TRUNC(SYSDATE) - :P2_DAYSAGO - 1
    AND name = :P1_NAME
    ORDER BY ts
    Further more, it seems :P1_NAME in the same subquery is not working for the chart, i get xml parsing errors in SVGviewer, however the same query works for the spread sheet area, I am really puzzeled. Not sure whether it's dumb tool or dumb me :-)
    Appreciate your help!
    Jianhui

    <quote>
    Further more, it seems :P1_NAME in the same subquery is not working for the chart, i get xml parsing errors in SVGviewer, however the same query works for the spread sheet area, I am really puzzeled. Not sure whether it's dumb tool or dumb me :-)
    </quote>
    For this particular issue, I found out that neither is the tool dumb nor is me. It's SVGViewer messed up with the firefox browser, after I rebooted the computer this morning, problem is gone. I didnt reboot after I copied SVGViewer dll and zip file to firefox plugin directory yesterday. Never had that pain with IE and Netscape, oh well :-). So please ignore this section, however other questions are still unsolved puzzles for me. Thank you all if you can share some light on those questions.

  • Follwing query fails on one database, but the same works on other Database

    Hi,
    The following SQL fails on one database with ORA-01722 but the same works on other database.
    SQL> SELECT i.version, d.name, i.instance_name, i.host_name
    FROM v$instance i, v$database d, v$parameter p 2
    3 WHERE p.name = 'instance_number'
    4 AND DECODE(p.value, 0, 1, p.value) = i.instance_number;
    AND DECODE(p.value, 0, 1, p.value) = i.instance_number
    ERROR at line 4:
    ORA-01722: invalid number
    both databases are at same version (10.2.0.1) both are on same machine.
    Initailly I suspected NLS settings, I am surprised to see NLS settings are also same on both the databases.
    Any thoughts why is it happening

    Thanks for the reply
    Yes, i know that i am comparing varchar against number.
    bu there is no way that the database where the query is working has correct types on both sides as the tables are standard oracle dictionary tables.
    Yes, i tried this earlier, it works
    AND DECODE(p.value, '0', '1', p.value) = to_char(i.instance_number)
    it is very weired to see that error, i feel it something else that causing the trouble.

  • Running the same sql script in multiple databases

    Hello,
    What is the method to run the same sql script in multiple databases? I want to write a unix script that would select from different databases and run a sql/plsql script in those different databases. What are the ways to write such a unix script? Thank you in advance.

    Just have a parameter which takes in the oracle connection parameters and use it in your sqlplus script with your shell script.
    Your sqlplus script can have a procedure/function call or an anonymous block;
    Then have a wrapper script to call the original script with different connection parameters. Hope this helps.

  • Can't run non-UNICODE-DbSl against UNICODE database

    Hi everyone. I get this error during the update of Solution Manager 7.1 SPS4 (dual stack) to SPS10. It is a green install. This happens during the
    phase PREP_EXTRACT/PREIMP! Of the ABAP stack. Step 5.2. I do not see a lot of people with this problem, so I assume it is something I am doing wrong, as it is my first time using the tool SUM.
    Details of the system:
    Solution Manager 7.1 SPS4
    Windows 2008 R2 64 bit
    Microsoft SQL 2008 R2 64 bit SP1
    Central installation type with all components on
    the same host
    Kernel level 600
    Here is what I have done so far:
    Downloaded the media as described in the installation
    guide.
    Worked my way through the install using the
    Software Provision Manager 1.0
    Updated the Kernel from level 401 to 600, by
    copying the files from the download folder to the F:\usr\sap\SM1\SYS\exe\uc\NTAMD64
    folder. This is the folder that is assigned to the DIR_CT_RUN parameter.
    I start the STARTUP.BAT file in the SUM folder.
    I then start the SUM GUI and run through the
    steps and in step 3 I map the Stack configuration file (XML) to one listed in
    the folder “51047130\DATA” called “SPS10_stack.xml”
    Then I
    get to 5.2 where the system stops with this error:
    Severe error(s) occurred in phase PREP_EXTRACT/PREIMP!
    Last error code set: Single errors (code &lt;= 8) found in logfile 'PREIMP.ELG'
    ERROR: Detected the following errors:
    # F:\usr\SUM\abap\log\R710VPE.<DB>:
          4 ETW000 TRACE-INFO: 19:  [    dev trc,00000]  Driver: sqlncli10.dll Driver release: 10.50.2769                                3938  0.039733
          4 ETW000 TRACE-INFO: 20:  [    dev trc,00000]  GetDbRelease: 10.50.2769.00                                                      1603  0.041336
          4 ETW000 TRACE-INFO: 21:  [    dev trc,00000]  GetDbRelease: Got DB release numbers (10,50,2769,0)                                21  0.041357
          4 ETW000 TRACE-INFO: 22:  [    dev trc,00000]  Can't run non-UNICODE-DbSl against UNICODE database                              2647  0.044004
          4 ETW000 TRACE-INFO: 23:  [    dev trc,00000]  CheckCodepageType failed. Connect terminated.                                      13  0.044017
          2EETW169 no connect possible: "DBMS = MSSQL                            ---  SERVER = '<SERVER>' DBNAME = '<DB>'"
    Can
    anyone please help?
    PS:
    The admin user that I use do have access to the database. It is listed with
    sysadmin role and the default DB is the Solution Manager db.

    ERROR: Detected the following errors:
    # F:\usr\SUM\abap\log\R710VPE.<DB>:
          4 ETW000 TRACE-INFO: 19:  [    dev trc,00000]  Driver: sqlncli10.dll Driver release: 10.50.2769                                3938  0.039733
          4 ETW000 TRACE-INFO: 20:  [    dev trc,00000]  GetDbRelease: 10.50.2769.00                                                      1603  0.041336
          4 ETW000 TRACE-INFO: 21:  [    dev trc,00000]  GetDbRelease: Got DB release numbers (10,50,2769,0)                                21  0.041357
          4 ETW000 TRACE-INFO: 22:  [    dev trc,00000]  Can't run non-UNICODE-DbSl against UNICODE database                              2647  0.044004
          4 ETW000 TRACE-INFO: 23:  [    dev trc,00000]  CheckCodepageType failed.
    As per error, you have used wrong kernel. Please make sure that you use unicode kernel as your system is also unicode.
    Thanks,
    Sunny

  • Different results for the same query and same data !  (oracle 9i)

    Hi,
    This is a mystery for me. I've got on my database exactly the same data that my customer (exported schema). We both launch the same query (generated by the software that we sold him). This query has a criteria IN (SELECT MAX()...) to get only data from the last year.
    The query gives 477 rows on my computer (correct answer), but no row on his! We have the same data! The only difference is the Oracle release : 9.2.0.6.0 for him, 9.2.0.1.0 for me.
    If he executes the subquery alone, it gives the expected result.
    If he replaces the MAX() in the subquery by the returned value (year 2016), he gets his 477 rows.
    I've rewritten the query with a NOT EXISTS, and now all is fine. (Less efficient but it works).
    I have no rational explication. Did I miss something ?
    Thanks for any answer.
    This is the query:
    SELECT ...
    FROM
    CRA, GRA, ...
    WHERE
    /* subselect */
    (CRA.COLLCOD, CRA.CRANEXE, CRA.CRANCODBUD, CRA.GRANNUM, CRA.CRANCOD1, CRA.CRANCOD2, CRA.CRANCOD3, CRA.CRANCOD4)
    IN (
    SELECT b.COLLCOD, MAX(cranexe), b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    FROM CRA b
    GROUP BY b.COLLCOD, b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    AND... /* other filters and joins */

    v9.2.0.1 was full of bugs. a lot of these bugs had to do with "incorrect results", typically associated with old stats or complex queries (certain types of subqueries were very likely to give wrong resutls, due to the way they were rewritten by the optimizer).
    apply the 9.2.0.6 patch set

Maybe you are looking for

  • Microsoft Office and Adobe Won't Open After 3/11 Updates

    This morning I installed all of the 3/11 updates (Java update, daylight savings time, Quicktime, etc.). After my computer restarted, I can no longer open any Microsoft office product (Word, Excel, and Powerpoint) or Adobe Reader. There is not specifi

  • Creation of material as TRAD

    Hi guys, I am asked by QA to maintain Financial views (Accounting7Costing) for a material that is cost of freight that we want to invoice to the customer. They would like to register this material as TRAD, but my problem is that I then have to determ

  • Trying to import video"Could not complete your request because it is not the right kind of document"

    When I try to import a video into Photoshop CS6 I get the error: "Could not complete your request because it is not the right kind of document". I have tried multiple formats with no luck.  I was able to improt it into Photoshop CS5 by dragging and d

  • Read the file line by line from upload

    Hi Guys, Need help... I creating a web application that has a upload capability. What I want to do is this... I want to upload a file (but not save it). What I'm going to do is just read the file line by line and save these data to the database. How

  • Help with Callable Statements

    Hi, I am working on a problem which requires me to insert record into the database (mySQL) using Callable Statements. For this I have written 2 Stored Procedures (SP) which are as follows: CREATE DEFINER=`root`@`localhost` PROCEDURE `GeneratePcId`()