Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8753785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:29:29+00:00 2026-06-13T13:29:29+00:00

i have to create an range partitioned table with two hundred partitions. for eg:

  • 0

i have to create an range partitioned table with two hundred partitions. for eg:

CREATE TABLE emp (
     empno NUMBER(4), 
     ename VARCHAR2(30), 
     sal   NUMBER
) 
PARTITION BY RANGE(empno) (
partition e1 values less than (1000)     , 
partition e2 values less than (2000)     , 
...
partition e200 values less than (MAXVALUE) 

);

Is there a way to specify the range interval without writing two hundred lines for just specifing the range?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:29:31+00:00Added an answer on June 13, 2026 at 1:29 pm
    CREATE TABLE emp (
         empno NUMBER(4), 
         ename VARCHAR2(30), 
         sal   NUMBER
    ) 
    PARTITION BY RANGE(empno) (
    partition e1 values less than (1000));
    
    begin
      for k in 2..200 
      loop
         execute immediate 
           'alter table emp add partition e'||k||' values less than  ('||k*1000||')';
      end loop
    end;
    

    UPDATE: In 11g exists a feature to specify an interval for range partitions and partitions will be created when you insert into the table.

    But I don’t like it and I don’t recommend it for two reasons:

    1 You should allways keep the first partition, because is the reference. If you try to drop it you’ll get SQL Error: ORA-14758: Last partition in the range section cannot be dropped;

    2 You don’t have control on partition names(AFAIK) and interval(this is ugly). If, by mistake you insert a value in future some partitions will be skipped and you’ll get fat partitions:
    (studied a litle and there is no fat partition. Added to example.)

     Create table Z_TB_PART_TEST(
        id number
      )
      partition by range(id)
      interval(1000)
     (
        PARTITION PART_01 VALUES LESS THAN (1000)
     );  
    
     INSERT INTO Z_TB_PART_TEST values (1500);
     INSERT INTO Z_TB_PART_TEST VALUES (10000);
     INSERT INTO Z_TB_PART_TEST VALUES (5000);
    
    
      SELECT partition_name , high_value
      FROM USER_TAB_PARTITIONS
      WHERE table_name = 'Z_TB_PART_TEST';
    
      PART_01   1000
      SYS_P141  2000
      SYS_P142  11000
      SYS_P143  6000
    

    UPDATE2: Nicholas Krasnov indicated in a comment an workaround for point one:

    What about ORA-14758? It can be easily avoided:
    We temporarily convert our interval partitioning table to the range
    partitioning table (alter table tb_table_test set interval()), drop
    partition and then switch back to the interval partitioning table
    (alter table tb_part_test set interval(1000)).

    It works, I’ve tested it. However should be noticed that all partitions will freeze, they will be range partitions. If you had gaps will remain(no partition will be added in gaps). So, the reference partition will be the last partition before altering to interval. This is what the error says: Last partition in the range section cannot be dropped.

    So, you’ll have a section of range partitioning and a section of Interval partitioning with all its benefits.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big table with partitions. ex: CREATE TABLE cust_order ( cust_id NUMBER(10),
I have a table 'X' and did the following CREATE PARTITION FUNCTION PF1(INT) AS
I have created four partitions in SQL Server using the following functions. CREATE PARTITION
I have create name range on sheet A so I need to use this
I have create to fields in my form and I have place in, two
I have been trying to create a dynamic range within excel that would include
I have a table called tbl_rtdata. I was dropped the all partitions in that
I have a very large table with a fulltext indexed column. If I partition
I dont understand how to create two date columns and create range between them?
I have the following table structure with live data in it: CREATE TABLE IF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.