Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Adding in made-up rows - looking for more efficient solutions

BoneistJun 19 2009 — edited Jun 19 2009
Hi guys,

I've got a situation where I'm trying to replace a slow-by-slow procedure with a SQL statement. Seems fairly easy so far, except when it comes to the adding in rows that don't exist.

I've got two tables, t1 holds the data, t2 holds information about the rows that each id in t1 should have. I've managed to get the result I want, but it requires two passes through t1 which I'd like to avoid if at all possible:
with t1 as (select 1 id, 'a' vol, 100 amount from dual union all
            select 1 id, 'c' vol, 200 amount from dual union all
            select 1 id, 'd' vol, 300 amount from dual union all
            select 2 id, 'b' vol, 400 amount from dual),
     t2 as (select 'b' vol, 1 order_index from dual union all
            select 'd' vol, 2 order_index from dual union all
            select 'a' vol, 3 order_index from dual union all
            select 'c' vol, 4 order_index from dual)
select t4.id, t4.vol, nvl(t1.amount, 0) amount
from   (select t3.id, t2.vol, t2.order_index
        from   (select distinct id
                from t1) t3,
               t2) t4,
        t1
where  t4.id = t1.id (+)
and    t4.vol = t1.vol (+)
order by t4.id, t4.order_index;

        ID V     AMOUNT
---------- - ----------
         1 b          0
         1 d        300
         1 a        100
         1 c        200
         2 b        400
         2 d          0
         2 a          0
         2 c          0
Anyone got any better ways of doing this, or am I stuck with two passes through t1?
This post has been answered by 21205 on Jun 19 2009
Jump to Answer

Comments

unknown-698157
Answer
No. Partitioning is an extra cost option in Enterprise Edition.

--------------
Sybrand Bakker
Senior Oracle DBA
Marked as Answer by 692707 · Sep 27 2020
Aman....
You need to ahve EE edition to use it,
http://www.oracle.com/database/product_editions.html

HTH
Aman....
692707
Are there any alternatives for that..?

How should we import the tables created with partition in enterprise edition into a standard edition...???
Satish Kandi
Assuming your source and target oracle versions are the same, try pre-creating the table on target database as regular table and import with ignore=y.
1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 17 2009
Added on Jun 19 2009
6 comments
787 views