Bug report select statement nested select in FROM Clause on Oracle 10g

The SELECT statement below does not return the appropriate result; it used to work on Oracle 8, but it does not on 10g (10.2).
Here is the table
create table T (
A numeric(4),
B numeric(4)
Some data
insert into T (A,B) VALUES (1,null);
insert into T (A,B) VALUES (2,1);
insert into T (A,B) VALUES (3,1);
insert into T (A,B) VALUES (3,2);
The select statement returning the worng result
select totals.A, totals.totalBbyA
from (
select t1.A, sum(t1.B) totalBbyA
from T t1
group by A
) totals
where
totals.totalBbyA >= all
select sum(nvl(t2.b,0)) from T t2 group by t2.a
it returns "no rows selected"
An equivalent select that does return the good result
select t1.A, sum(t1.B) totalBbyA
from T t1
group by A
having
sum(t1.B) >= all
select sum(nvl(t2.b,0)) from T t2 group by t2.a
It returns
A TOTALBBYA
3 3
Best regards

910893 wrote:
but it does not on 10g (10.2).Works fine in:
SQL> select  *
  2    from  v$version
  3  /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> select  *
  2    from  t
  3  /
         A          B
         1
         2          1
         3          1
         3          2
SQL> select totals.A, totals.totalBbyA
  2  from (
  3  select t1.A, sum(t1.B) totalBbyA
  4  from T t1
  5  group by A
  6  ) totals
  7  where
  8  totals.totalBbyA >= all
  9  (
10  select sum(nvl(t2.b,0)) from T t2 group by t2.a
11  )
12  ;
         A  TOTALBBYA
         3          3
SQL> SY.

Similar Messages

  • SELECT OID FROM clause not working

    The following statements gets ORA-00904: "OID": invalid identifier.
    The SELECT OID FROM clause is intended to pull in a REF to the MANAGER with MGR_ID= 000001.
    Oracle seems to think there are no OIDs for the entries in the MANAGERS table.
    INSERT INTO STORES VALUES (
    100001,
    ADDRESS(888, 'Main_Street', 'Rancho_Alegre', 'CA', '94049'),
    COF_ARRAY('Colombian', 'French_Roast', 'Espresso', 'Colombian_Decaf', 'French_Roast_Decaf'),
    (SELECT OID FROM MANAGERS WHERE MGR_ID = 000001)
    Here is how the MANAGER, MANAGERS, ans STORES were defined.
    CREATE TYPE MANAGER AS OBJECT (
    MGR_ID INTEGER,
    LAST_NAME VARCHAR(40),
    FIRST_NAME VARCHAR(40),
    PHONE char(10)
    CREATE TABLE MANAGERS OF MANAGER OBJECT IDENTIFIER IS SYSTEM GENERATED;
    CREATE TABLE STORES (
    STORE_NO INTEGER,
    LOCATION ADDRESS,
    COF_TYPES COF_ARRAY,
    MGR REF MANAGER
    My questions:
    1. I don't see any OIDs when I display the MANAGERS table with the Object Browser. That is normal it isn't it? Aren't they always hidden?
    2. Can anyone tell me what I am doing wrong?

    [Documentation Says....|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28371/adobjdes.htm]
    The object identifier column is a hidden column that Oracle uses to construct references to the row objects. *Oracle provides no access to the internal structure of object identifiers*. This structure can change at any time. Applications are only concerned with using object references for fetching and navigating objects.
    In the above mentioned link is a link to what i think you're attempting...
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28371/adobjint.htm#i458258

  • Licensed version and free download from OTN of Oracle 10g DB

    I had a doubt with any difference with the licensed version and free download from OTN of Oracle 10g DB. We had downloaded a free version of oracle 10g
    database from OTN and are using it in our live environment. It seems to be working fine. We are trying to get a licensed copy of Oracle 10g DB also but that may take sometime. So, my doubt is whether the free download from OTN should not create any problems in our live environment.
    I hope, my question is clear.
    Please, help in solving the doubt.
    regards

    Hello,
    There is no difference whether you download from OTN or get so called licensed copy of oracle software. It's free to download and free to use you are using for personal eduction purpose, but if you are using for commercial purpose then you should contact oracle sales for pricing but you can continue with the same software. See following link for certification on different platform
    http://www.oracle.com/technology/support/metalink/index.html
    Regards

  • Migrating database from PostgreSql to Oracle 10g

    Hi
    can anybody help me by providing steps to migrating database from PostgreSql to Oracle 10g. its very urgent requirement. so please let me know if anyone know about this setps.
    thanks in advance.
    jayesh
    cignex technology pvt ltd

    NPD wrote:
    Hi Guys,
    Can one migrate database from sql2005 to Oracle.
    Thanx.You can use [Oracle Migration Tool |http://www.oracle.com/technology/tech/migration/workbench/index.html]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • Select count(*) from table in oracle 11g with direct path read takes time

    select count(*) from table takes long time, even more than couple of hours..
    direct path read is the wait event which is almost is at 99%..
    can u someone provide some info on this.. on solution.. thankx

    knowledgespring wrote:
    table has millions of records... 130 millions..
    select count(*) from BIG_SIZE_TABLE; --- executed in sql plus command prompt.
    Rows     Execution Plan
    0  SELECT STATEMENT   MODE: ALL_ROWS
    0   SORT (AGGREGATE)
    0    TABLE ACCESS   MODE: ANALYZED (FULL) OF 'BIG_SIZE_TABLE' (TABLE)
    Elapsed times include waiting on following events:
    Event waited on                             Times   Max. Wait  Total Waited
    ----------------------------------------   Waited  ----------  ------------
    SQL*Net message to client                       1        0.00          0.00
    enq: KO - fast object checkpoint                1        0.01          0.01
    Disk file operations I/O                       18        0.00          0.00
    direct path read                            58921        0.34        418.54direct path read time waited is : 58921 total time waited: 418.54
    That 418 seconds - not the hours you reported earlier. Is it possible that your connection to the database broke ?
    On a typical system, by the way, you can usually turn one direct read for tablescan into 1MB, so your scan seems to have covered about 59 GB, which seems to be in the right sort of ballpark for 130M rows.
    we have another query and when we test the query execution using v$sql, is_bind_sensitive =N, how to make is_bind_sensitive=Y all the time.. There is a hint /*+ bind_aware */ - I'd have to check whether or not it's documented at present. It might help.
    I would be interested in hearing why you think the hint should be bind sensitive when the optimizer doesn't.
    Regards
    Jonathan Lewis

  • Select in FROM clause not working

    Hello,
    I have three tables with one table containing the name of the other two tables and i want to select dynamically the two selects based on their ID that matches in the first table.
    CREATE TABLE_NAMES (ID NUMBER, TableName VARCHAR(2) )
    CREATE TRADE (activites VARCHAR(2), TRADE_ID )
    CREATE CONTRACT(activites VARCHAR(2), TRADE_ID )
    INSERT INTO TABLE_NAMES ( 101, 'TRADE' );
    INSERT INTO TABLE_NAMES ( 202, 'CONTRACT' );
    INSERT INTO TRADE ('TRADE 1' , 101 )
    INSERT INTO CONTRACT ('CONTRACT 1' , 202 )
    What I wanted to do is select the table name dynamically based up on the id in TABLE_NAMES
    and I failed when doing this
    SELECT SELECTED_TABLE.activites FROM ( SELECT TABLE_NAME FROM TABLE_NAMES WHERE ID = 101 ) SELECTED_TABLE
    OR a more generic form with JOIN statement also did not work
    SELECT SELECTED_TABLE.activities FROM TABLE_NAMES SELECTION JOIN ( SELECT TABLE_NAME FROM TABLE_NAMES) SELECTED_TABLE
    ON SELECTION.ID = SELECTED_TABLE.TRADE_ID
    Thanks in advance

    What you are trying to do will not work. To accomplish your requirement you would have to use dynamic SQL.
    However, I want to stress that this is probably not a good design decision because:
    1. Maintainability of the code may be jeopardized
    2. Dynamic SQL could be laden with SQL injection vulnerabilities
    3. Dynamic SQL generally does not perform as well as static SQL.
    HTH!

  • Select in From-Clause with JPQL

    Hey,
    I'm new to JPA development. How can I transform the following SQL-Statement:
    select a from
    Gpsj a,
    (select c.tsid, c.wsid, max(c.gdat1) maxgdat from Gpsj c where c.tsid = '901' group by tsid, wsid) b
    where a.tsid = b.tsid
    and a.wsid = b.wsid
    and a.gdat1 = b.maxgdat
    I can't find any expression for using a (select-statement in a from-clause)
    thanks
    Nikolai

    JPQL does not support sub-selects in the from clause. You can use a native SQL query for this in JPA.
    James : http://www.eclipselink.org

  • Connect By not working with nested queries in from clause.

    Using Connect By on a query which has a nested from clause(The from clause fetches around 100k records) gives incorrect results but if the same nested queries are used to build a table and the Connect By is used on the table then the output is correct.
    I put the nested queries in a 'WITH' clause and got the correct output also.
    I am not sure how to give the code here as you would need dump to make them work.
    I am giving the a sample code:
    --Non Working Code
    SELECT     con_item, prod_item, compsite, bcsite, ibrsite, res
          FROM (SELECT con_item, prod_item, compsite, bcsite, ibrsite, res
                  FROM (SELECT bd.item AS con_item, bd.fromid AS compsite,
                               bd.toid AS bcsite, bd.toid AS ibrsite,
                               bd.bodname AS ID, bd.item AS prod_item,
                               'BOD' AS res
                          FROM TABLE1 bd
                        UNION
                        SELECT bc.item AS con_item,
                               bc.componentsiteid AS compsite,
                               bc.siteid AS bcsite, ibr.siteid AS ibrsite,
                               ibr.routingid AS ID, ibr.item AS prod_item,
                               op.resourcename AS res
                          FROM TABLE2 ibr,
                               TABLE3 bc,
                               TABLE4 op
                         WHERE ibr.bomid = bc.bomid
                           AND ibr.siteid = bc.siteid
                           AND ibr.routingid = op.routingid(+))
                 WHERE con_item IN ('SCFCD0T9B', 'SWXCD0S9B')
                   AND ibrsite LIKE 'CRCW%HSM')
    START WITH ibrsite = 'CRCW_QA_HSM' AND prod_item = 'SWXCD0S9B'
    CONNECT BY PRIOR con_item = prod_item AND PRIOR compsite = bcsiteWorking Code:
    --The table TEST_V is constructed on the from clause of above query
    SELECT     CON_ITEM, PROD_ITEM, COMPSITE, BCSITE, IBRSITE, RES
          FROM TEST_V
    START WITH IBRSITE = 'CRCW_QA_HSM' AND PROD_ITEM = 'SWXCD0S9B'
    CONNECT BY PRIOR CON_ITEM = PROD_ITEM AND PRIOR COMPSITE = BCSITEAlso another working code:
    WITH SUB AS
         (SELECT BD.ITEM AS CON_ITEM, BD.FROMID AS COMPSITE, BD.TOID AS BCSITE,
                 BD.TOID AS IBRSITE, BD.BODNAME AS ID, BD.ITEM AS PROD_ITEM,
                 'BOD' AS RES
            FROM TABLE1 BD
          UNION
          SELECT BC.ITEM AS CON_ITEM, BC.COMPONENTSITEID AS COMPSITE,
                 BC.SITEID AS BCSITE, IBR.SITEID AS IBRSITE, IBR.ROUTINGID AS ID,
                 IBR.ITEM AS PROD_ITEM, OP.RESOURCENAME AS RES
            FROM TABLE2 IBR, TABLE3 BC, TABLE4 OP
           WHERE IBR.BOMID = BC.BOMID
             AND IBR.SITEID = BC.SITEID
             AND IBR.ROUTINGID = OP.ROUTINGID(+))
    SELECT     CON_ITEM, PROD_ITEM, COMPSITE, BCSITE, IBRSITE, RES, LEVEL
          FROM SUB
    START WITH PROD_ITEM = 'SWXCD0S9B' AND IBRSITE = 'CRCW_QA_HSM'
    CONNECT BY PRIOR COMPSITE = BCSITE AND PRIOR CON_ITEM = PROD_ITEMI am sorry if I am giving incorrect syntax, please let me know if my giving the dump of table be of any help.
    Regards,
    Vikram
    Edited by: BluShadow on 11-Jan-2012 11:05
    fixed {noformat}{noformat} tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi, Vikram,
    Welcome to the forum!
    user2765706 wrote:
    Using Connect By on a query which has a nested from clause(The from clause fetches around 100k records) gives incorrect results but if the same nested queries are used to build a table and the Connect By is used on the table then the output is correct.
    I put the nested queries in a 'WITH' clause and got the correct output also.What exactly is the problem? Why not use one of the queries that gives the correct output? I find that WITH clauses are a lot easier to understand and debug than in-ine views, anyway.
    Are you just wondering why one of the queries doesn't work?
    I am not sure how to give the code here as you would need dump to make them work. You're absolutely right! You need to post some sample data and the results you want from that data. Without that, it's much harder for people to understand what the problem is, or how to fix it.
    I am giving the a sample code:
    --Non Working CodeLet's call this Query 1.
    SELECT     con_item, prod_item, compsite, bcsite, ibrsite, res
    FROM (SELECT con_item, prod_item, compsite, bcsite, ibrsite, res
    FROM (SELECT bd.item AS con_item, bd.fromid AS compsite,
    bd.toid AS bcsite, bd.toid AS ibrsite,
    bd.bodname AS ID, bd.item AS prod_item,
    'BOD' AS res
    FROM TABLE1 bd
    UNION
    SELECT bc.item AS con_item,
    bc.componentsiteid AS compsite,
    bc.siteid AS bcsite, ibr.siteid AS ibrsite,
    ibr.routingid AS ID, ibr.item AS prod_item,
    op.resourcename AS res
    FROM TABLE2 ibr,
    TABLE3 bc,
    TABLE4 op
    WHERE ibr.bomid = bc.bomid
    AND ibr.siteid = bc.siteid
    AND ibr.routingid = op.routingid(+))
    WHERE con_item IN ('SCFCD0T9B', 'SWXCD0S9B')
    AND ibrsite LIKE 'CRCW%HSM')
    START WITH ibrsite = 'CRCW_QA_HSM' AND prod_item = 'SWXCD0S9B'
    CONNECT BY PRIOR con_item = prod_item AND PRIOR compsite = bcsite
    [\CODE]
    Working Code:Let's call this Query 2.
    --The table TEST_V is constructed on the from clause of above query
    SELECT     CON_ITEM, PROD_ITEM, COMPSITE, BCSITE, IBRSITE, RES
    FROM TEST_V
    START WITH IBRSITE = 'CRCW_QA_HSM' AND PROD_ITEM = 'SWXCD0S9B'
    CONNECT BY PRIOR CON_ITEM = PROD_ITEM AND PRIOR COMPSITE = BCSITE
    [\CODE]Why does Query 1 not do the same thing as Query 2? That depends on what is in test_v. Only you know what test_v is, so only you can say. If you'd post the code that created test_v, maybe somebody else could help.
    Also another working code:Let's call this Query 3.
    WITH SUB AS
    (SELECT BD.ITEM AS CON_ITEM, BD.FROMID AS COMPSITE, BD.TOID AS BCSITE,
    BD.TOID AS IBRSITE, BD.BODNAME AS ID, BD.ITEM AS PROD_ITEM,
    'BOD' AS RES
    FROM TABLE1 BD
    UNION
    SELECT BC.ITEM AS CON_ITEM, BC.COMPONENTSITEID AS COMPSITE,
    BC.SITEID AS BCSITE, IBR.SITEID AS IBRSITE, IBR.ROUTINGID AS ID,
    IBR.ITEM AS PROD_ITEM, OP.RESOURCENAME AS RES
    FROM TABLE2 IBR, TABLE3 BC, TABLE4 OP
    WHERE IBR.BOMID = BC.BOMID
    AND IBR.SITEID = BC.SITEID
    AND IBR.ROUTINGID = OP.ROUTINGID(+))
    SELECT     CON_ITEM, PROD_ITEM, COMPSITE, BCSITE, IBRSITE, RES, LEVEL
    FROM SUB
    START WITH PROD_ITEM = 'SWXCD0S9B' AND IBRSITE = 'CRCW_QA_HSM'
    CONNECT BY PRIOR COMPSITE = BCSITE AND PRIOR CON_ITEM = PROD_ITEM
    [\CODE]Why does Query 1 not do the same thing as Query 3? Query 1 has these conditions:
    ...           WHERE con_item IN ('SCFCD0T9B', 'SWXCD0S9B')
                    AND ibrsite LIKE 'CRCW%HSM'but Query 3 does not.
    I am sorry if I am giving incorrect syntax, please let me know if my giving the dump of table be of any help.Yes, that always helps. Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data. Simplify the problem as much as possible. For example, if you have the same problem when you leave out one of the tables, then don't include that table in the problem.
    Always say what version of Oracle you're using. This is especially important with CONNECT BY queries, because every version since Oracle 7 has had major improvements in this area.

  • Nested query in FROM clause causes 'SQL Command not properly ended' error

    SELECT sj.job_id AS job_id, 'STATUS_AWAITING_PREPARATION' AS job_status, sjr.email_sys_attach_filename AS attach_filename, sje.emailaddr as emailaddr_lastsentto
                        FROM arsnd_jobs sj, (SELECT emailaddr from ARSND_JOB_EMAILS where job_id=sj.job_id AND ROW_NUM=1) as SJE, ARSND_JOB_QUEUE sjq,ARSND_JOB_RECIPIENTS sjr
                        WHERE sj.job_id=sjq.job_id and sj.job_id=sjr.job_id
                        AND sjq.PROCESSING_STATE=0
                        ORDER BY sj.created
    I don't see anything wrong with the above query, it fails with 'SQL Command not properly ended'.
    If I remove the usage of the nested query in the FROM clause, then it doesn't give that error. Please advice what I'm doing wrong.

    Pls try
    SELECT sj.job_id AS job_id, 'STATUS_AWAITING_PREPARATION' AS job_status, sjr.email_sys_attach_filename AS attach_filename, sje.emailaddr as emailaddr_lastsentto
    FROM arsnd_jobs sj, (SELECT emailaddr from ARSND_JOB_EMAILS where job_id=sj.job_id AND ROW_NUM=1) SJE, ARSND_JOB_QUEUE sjq,ARSND_JOB_RECIPIENTS sjr
    WHERE sj.job_id=sjq.job_id and sj.job_id=sjr.job_id
    AND sjq.PROCESSING_STATE=0
    ORDER BY sj.created
    I have removed the 'as' clause you used for alias of the subquery. It should work fine now.....

  • Selective export failing - Solaris Sparc - Oracle 10g

    HI Gurus,
    I am trying to export selective data from one of my prod database tables. But not succeeding. I was keep on trying for the past 2 hours.
    Could anybody please verify the script and let me know what was wrong in it. Thanks in advance
    OS : SOLARIS SPARC
    ORACLE - 10G
    Query --> WHERE E3RECV_DT LIKE '201305%' (I need to export this query data)
    Below Script i am using
    ===============
    exp E3USER@SGEBAPU2 statistics=none consistent=n buffer=100000000 file=exp_pipe_file TABLES=IFDATA query=\"WHERE E3RECV_DT LIKE '201305\%'\" log=PGTB_IFDATA_conditional.log

    Nagaraju P wrote:
    HI Gurus,
    I am trying to export selective data from one of my prod database tables. But not succeeding. I was keep on trying for the past 2 hours.
    Could anybody please verify the script and let me know what was wrong in it. Thanks in advance
    OS : SOLARIS SPARC
    ORACLE - 10G
    Query --> WHERE E3RECV_DT LIKE '201305%' (I need to export this query data)
    Below Script i am using
    ===============
    exp E3USER@SGEBAPU2 statistics=none consistent=n buffer=100000000 file=exp_pipe_file TABLES=IFDATA query=\"WHERE E3RECV_DT LIKE '201305\%'\" log=PGTB_IFDATA_conditional.logconsider placing everything on Control file to avoid fighting with the command line interpreter.
    my car is not succeeding.
    Tell me how to make my car go.
    use COPY & PASTE so we can see what you do & exactly how Oracle responds.
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Nested tables and multiset operators in Oracle 10g

    Consider the following scenario:
    We have two identical relations R and S defined as:
    CREATE TABLE R(
    a INTEGER,
    b table_type)
    NESTED TABLE b STORE as b_1;
    CREATE TABLE S(
    a INTEGER,
    b table_type)
    NESTED TABLE b STORE as b_2;
    where table_typ is defined as
    CREATE TYPE table_typ AS TABLE OF VARCHAR2(8);
    Suppose we have two instances of R and S, each having one tuple as follows: R(1,table_typ('a','b')) and S(1,table_typ('b','c')).
    I would like to "merge" these two simple instances (e.g., achieve the effect of a simple SELECT * FROM R UNION SELECT * FROM S query) and obtain the following resulting instance: Result(1,table_typ('a','b','c')).
    Would this be possible in Oracle 10g? A simple UNION does not work (I got a "inconsistent datatypes: expected - got SCOTT.TABLE_TYP" error). I also took a look at the MULTISET UNION operator over nested tables available in Oracle 10g, but it doesn't seem to get me anywhere. Any help on this would be greatly appreciated.
    Thank you,
    Laura

    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
      2  /
    Type created.
    SQL> CREATE TABLE r(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_1;
    Table created.
    SQL> CREATE TABLE s(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_2;
    Table created.
    SQL> INSERT INTO r VALUES (1, table_type ('a', 'b'));
    1 row created.
    SQL> INSERT INTO s VALUES (1, table_type ('b', 'c'));
    1 row created.
    SQL> COLUMN c FORMAT A10;
    SQL> SELECT r.a, r.b MULTISET UNION DISTINCT s.b c
      2  FROM   r, s
      3  WHERE  r.a = s.a;
             A C
             1 TABLE_TYPE('a', 'b', 'c')
    SQL>

  • Curious about this From clause in Oracle XE

    SQL view of query Builder gives the following:
    select     "EMPLOYEES"."EMPLOYEE_ID" as "EMPLOYEE_ID",
         "EMPLOYEES"."FIRST_NAME" as "FIRST_NAME",
         "EMPLOYEES"."LAST_NAME" as "LAST_NAME"
    from     "EMPLOYEES" "EMPLOYEES"
    Why does the from clause showing "EMPLOYEES" "EMPLOYEES"?
    In the SQL Commands of the SQL the folowing query
    select     "EMPLOYEES"."EMPLOYEE_ID" as "EMPLOYEE_ID",
         "EMPLOYEES"."FIRST_NAME" as "FIRST_NAME",
         "EMPLOYEES"."LAST_NAME" as "LAST_NAME"
    from     "EMPLOYEES
    gives the same result and so does
    select     "EMPLOYEES"."EMPLOYEE_ID" as "EMPLOYEE_ID",
         "EMPLOYEES"."FIRST_NAME" as "FIRST_NAME",
         "EMPLOYEES"."LAST_NAME" as "LAST_NAME"
    from     "EMPLOYEES" "EMPLOYEES"
    What is the significence of the second "Employees" in the FROM clause.

    Other interesting feature is the double quotes
    although the one above works as well.
    Why is this?Habit.
    Some developers come from environments that support mixed case identifiers (table and column names). These developers sometimes go out of their way to force Oracle to use mixed case identifiers, and that requires double quotes.
    So Oracle seems to have gotten into the habit of surrounding all identifiers (coming from generated code) with double quotes to keep these developers (who usually have other porting issues anyway) from having to trace those identifier issues.

  • Avoid Bug 7146375 ORA-4030 MEMORY LEAK IN (Xml generation) in oracle 10g

    Hi All,
    I have to generate an xml from database which contains around 4 lac records. I had written a query using XmlSerialize and XmlElement.
    It does run properly for records less than 2 lacs.
    But when the record count goes above 2 lacs..it is throwing the following error -
    { ORA-04030: out of process memory when trying to allocate 1032 bytes (qmxlu subheap,qmemNextBuf:alloc)
    ORA-06512: at "SYS.XMLTYPE", line 111!}
    For the above error - I have tried increasing pga from 480M to 800M, but still we are getting the same error.
    After researching i found out -
    Cause
    This is caused by the following bug:
    Bug 7146375 ORA-4030 AND MEMORY LEAK IN SESSION HEAP: "KOH DUR HEAP D"
    Solution
    Bug 7146375 is fixed in 11.2
    So i tried out the query in another a db which has 11g installed and my query runs perfectly fine for records of upto 4 lacs.
    But since we have oracle 10g on our clients machine, are there other ways to achieve this XML generation other than this?
    Thanks.

    913389 wrote:
    After researching i found out -
    Cause
    This is caused by the following bug:
    Bug 7146375 ORA-4030 AND MEMORY LEAK IN SESSION HEAP: "KOH DUR HEAP D"
    Solution
    Bug 7146375 is fixed in 11.2
    So i tried out the query in another a db which has 11g installed and my query runs perfectly fine for records of upto 4 lacs.
    But since we have oracle 10g on our clients machine, are there other ways to achieve this XML generation other than this?I doubt it. If Oracle have investigated and created a bug report that says the solution is to upgrade to 11.2, then that's the answer, otherwise they would indicate that a particular 10g patch set can also be used.

  • Migrate datas from RDB to Oracle 10g

    The applications that use the RDB database are being re-write with Forms based on an Oracle database.
    Of course, before we use the new application, we will have a step for moving datas from old tables in Rdb to the new tables (new design) in Oracle (developpers are working on sql scripts for that). But when the new applications with Oracle db will be in production, I would like to save datas (datas as datas) from Rdb in an Oracle database with the same struture as the rdb structure (same tabels, with same columns and same datas in). The idea is we will be able to verify datas through SQL.
    Do you have any idea ?
    Thank you
    AnneMar

    Hi AnneMar,
    there exists a Metalink note that serves as a starter for such a migration:
    Note 135929.1: RDBPROD: Advice on Converting from Oracle Rdb to Oracle RDBMS
    For your convenience I am pasting that note here.
    Regards
    Wolfgang
    PURPOSE
    To provide general advice on migrating from Oracle Rdb to Oracle RDBMS
    SCOPE & APPLICATION
    This advice is intended for people who have already decided to convert, and are starting to plan how to do it. It provides a broad outline of how it can be done and some of the things to consider.
    Advice on Converting from Oracle Rdb to Oracle RDBMS
    General notes
    * The longer you leave it the easier it is likely to be. The SQL interfaces to Rdb are growing closer to those for RDBMS, particularly OCI Services for Rdb.
    * Converting the database will probably be the easy part. The applications are likely to require more work.
    * A staged approach is more likely to be successful than trying to do everything in one go.
    A possible strategy for converting
    1. Install OCI Services for Rdb. Pick a small application, or one that needs rewriting anyway. Convert the application using the method and tools of your choice to access the Rdb database via SQL*Net for Rdb. If unsatisfied with the results, you can repeat this with alternative methods or tools, until you find one that works for you.
    2. Install RDBMS. For those tables used by applications converted to use OCI Services, create database links. Point the converted application to the RDBMS database instead of the Rdb one. This step can be done whilst other applications are being converted. No data is yet stored in the RDBMS database, so any problems that arise with it, possibly due to lack of appropriate DBA experience, can be worked around by just pointing the programs back at the Rdb database.
    3. Now you have a choice.
    1. Gradually move the data into the RDBMS database. First new tables, then tables only accessed by applications that have already been converted. This has the advantage of taking one step at a time, so it would be easy to back up temporarily if a problem is found. The main disadvantage is that now that the data is spread over two databases your backup and recovery strategy will be more complicated.
    2. Finish converting the applications. Then transfer all the data over in one go. If there is a lot of data, then going back would be a big job, so there is more risk.
    Alternative common interfaces
    Besides OCI Services there are several other APIs that applications could use to access Rdb or RDBMS transparently.
    * JDBC - If your applications are written in JAVA or you want to rewrite them in JAVA
    * ODBC - If your applications run on Windows
    * .NET - If your applications run on Windows
    Techniques for converting a database
    * Transferring Metadata Extract the metadata using RMU/EXTRACT. Cut down and edit the output to produce a script to use to create the corresponding RDBMS objects.
    * Transferring data
    For small tables,
    INSERT INTO rdbms_table SELECT columns FROM rdb_table;
    (using dblinks to the rdb database and SQL*Net for Rdb)
    For large tables, use RMU/UNLOAD to create a delimited file and then load that into RDBMS using SQL$Loader.
    * Keeping data current in RDBMS while testing the transfer can be done using the Logminer Option in Rdb.
    Notes
    1. OCI Services for Rdb was formerly known as SQL*Net for Rdb and is part of Oracle SQL/Services. Though this is structured as a separate product from Oracle Rdb no additional license is needed.
    2. Some limits are different between Rdb and RDBMS.
    For example: in Rdb table and column names can be 31 bytes but RDBMS only allows 30.
    3. The RMU/EXTRACT command can write the SQL definitions of objects within a Rdb database to a text file.
    RELATED DOCUMENTS
    SQL*Net for Rdb
    Oracle Rdb Guide to SQL*Net for Rdb
    Oracle Rdb Oracle SQL/Services Release Notes
    Oracle Rdb A Comparison of SQL Dialects for Oracle and Oracle Rdb
    RMU/EXTRACT and /UNLOAD
    Oracle RMU Reference Manual
    SQL*Loader
    Oracle8 Server Utilities

  • Problems with OPMN from Companion CD (Oracle 10g R2 x86_64 RHEL4)

    I have installed Oracle 10g DB R2 64bit on RHEL4 x86_64 (AMD64) and HTTP-Server from Companion CD
    All works.
    But after running opmn appears problems:
    1. The system message to syslog: "ip_conntrack: table full, dropping packet"
    2. 'netstat -a' displays me thousands TCP-session on localhost to port 6100 in TIME_WAIT state
    And network services on my host more died than alive...
    If I increase ip_conntrack kernel parameter, then network state alive. But the problem with TCP-sessions is not resolved.
    Any ideas?
    Thanks, and sory for my english :-)
    P.S. I have RHEL4 without update 1, but with new kernel and patched binutils. Update of RHEL can resolve this problem?

    Thank you!
    The problem described in Metalink Doc-ID Note : 284602.1 is my case!
    But this document applies to Oracle Net Services - Version: 10.1.0.2 to 10.1.0.3.
    I have Version 10.2.0.1.0 and the problem apears again (with some symptoms are differ).

Maybe you are looking for

  • Step-by-Step guide for developing a ADF application, does it exist?

    Step-by-Step guide for developing a ADF application, does it exist? Hi there, At our company we recently begun working on a project using Oracle ADF with UIX. We got the Oracle JDeveloper 10g handbook and we did a 5 day Oracle ADF course. A good way

  • I am not receiving all of my emails in thundebird for multiple email accounts.

    I have been using Thunderbird fo rover a year with no issues. All of the sudden, I am unable to receive all of my emails. I can see the missing emails on my phone or ipad, but not on my computer on the Thunderbird account. it appears to be displaying

  • Ticket created on ECC does not show on SM7.0

    On ECC PROD, select help->create support message, fill up info and save, a support message is created. Because we have an SM7.0 based CHARM configured for above ECC landscape. The ticket created above should show up at that SM7.0 in txn crm_dno_monit

  • Stuck in offline mode - Outlook 2010

    I am stuck in offine mode in outlook 2010 and get back to online mode.  Any ideas?                                    [email protected]

  • POL-3314 with BLOB columns

    When trying to import images into BLOB columns, or read them back we get this error on WIN32 (surprisingly there is no problem at all on any of the windows mobile platforms like mobile 5 or ppc2003) Does anyone have a fix/work around for this? There