MAX EXTENTS  for a table

Hello Guru's
I am working on oracle express 10 G on windows , This is my test machine. I am a beginner to oracle Dba activities,
Problem:
I want to restrict the size of a table (say max upto 400k)
My Approach:
1. I create a Tablepsace with uniform extent size (40K each)
2. I created a table in this tablespace with max extents 10 ( so that 40K * 10 = 400K)
SCOTT@xe>CREATE TABLESPACE TB
  2   DATAFILE 'F:\Oracle\oradata\XE\TB.DBF' SIZE 100M
  3   EXTENT MANAGEMENT LOCAL
  4   UNIFORM SIZE 40K
  5   ONLINE ;
Tablespace created.
SCOTT@xe>
SCOTT@xe>DROP USER G CASCADE ;
User dropped.
SCOTT@xe>CREATE USER G IDENTIFIED BY G DEFAULT TABLESPACE TB ;
User created.
SCOTT@xe>ALTER USER G QUOTA UNLIMITED ON TB;
User altered.
SCOTT@xe>GRANT CREATE SESSION , CREATE TABLE TO G;
Grant succeeded.
SCOTT@xe>CONNECT G/G@xe
Connected.
G@xe>CREATE TABLE t ( A number) TABLESPACE TB storage (minextents 1 maxextents 10);
Table created.
G@xe>SELECT SEGMENT_NAME, MIN_EXTENTS, MAX_EXTENTS , SEGMENT_TYPE, TABLESPACE_NAME, BLOCKS
  2  FROM USER_SEGMENTS  ;
SEGMENT_NAME                                                                      MIN_EXTENTS MAX_EXTENTS SEGMENT_TYPE       TABLESPACE_NAME                    BLOCKS
T                                                                                           1  2147483645 TABLE              TB                                      5
G@xe>Issue is:
I want the maximun extents that could be llocated to this table must be 10 , BUT from user_segments I could see MAX_EXTENTS = 2147483645 (default value).
When i pump data into this table MAX_EXTENTS exceeds 10 (i.e user Defined value)
I have no idea why this is the case;
Regards,

When creating a segment (Table/Index) in a Locally Managed Tablespace (created with "EXTENT MANAGEMENT LOCAL" and visible in DBA_TABLESPACES under EXTENT_MANAGEMENT), Oracle ignores the specification of MAXEXTENTS.
All segments in an LMT would default to MAXEXTENTS UNLIMITED (which really means 2 billion).
(DEFAULT STORAGE at the Tablespace level cannot be set if it is LOCAL AUTOALLOCATE or LOCAL UNIFORM)
See [The 10gR2 documentation on the STORAGE clause|http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/clauses009.htm#i997450]
In your 10gXE install you will not be able to create a DICTIONARY MANAGED Tablespace as the SYSTEM Tablespace itself is LOCALLY MANAGED.
If you want to limit the size of a table you could
a. Create a Tablespace with a set size for datafiles (ie, set AUTOEXTEND OFF for the datafiles)
b. Create the Table in that Tablespace
Edited by: Hemant K Chitale on Aug 18, 2009 3:31 PM

Similar Messages

  • How to increase the max character for a table name..!!

    Hi All,
    The maximum characters that supports for the table Name is 30
    How can I increase this so that I can have table names lengthier than 30
    This is required as I was doing a conversion of the database from SQL server 2005 to Oracle 9i
    Many thanks in advance...
    Best Regards..,

    So How can I make it possible..?!!If it not possible, you cannot make it possible.
    If you can create a synonym on more than 30 char., you cannot use it on more than 30 char :
    SQL> create synonym my_very_long_synonym_name_for_emp_table for emp;
    Synonym created.
    SQL> select count(*) from my_very_long_synonym_name_for_emp_table;
    select count(*) from my_very_long_synonym_name_for_emp_table
    ERROR at line 1:
    ORA-00972: identifier is too long
    SQL> select * from user_synonyms;
    SYNONYM_NAME                   TABLE_OWNER                    TABLE_NAME
    DB_LINK
    /91b591a7_MY_VERY_LONG_SYNONYM SCOTT                          EMP
    SQL> select count(*) from "/91b591a7_MY_VERY_LONG_SYNONYM";
      COUNT(*)
            14Nicolas.

  • ORA-1631: max # extents reached in table INFILES

    Dear friends
    kindly give me the answer weather I am correct/wrong?
    Solution i have given is
    Alter table <tablename>
    storage(maxextents unlimited)
    Srinivas

    Before changing the table to allow an unlimited number of extents I would 1- verify that the table size is in line with its design usage and 2- that the program in question is not doing something stupid. If both of these are OK, and most of the time they will not be the problem, then you might also consider resizing the object since dictionary space management is in use.
    HTH -- Mark D Powell --

  • Max # extents exceeded

    Hi,
    I am having problems with the max # extents being exceeded.
    I am creating a spatial index using the following script:
    CREATE INDEX GIS.MYTABLE_SX ON
    GIS.MYTABLE(GEOMETRY)
    indextype is MDSYS.SPATIAL_INDEX
    parameters ( 'SDO_LEVEL=6,
         SDO_NUMTILES = 8,
         SDO_COMMIT_INTERVAL = 1000,
         TABLESPACE = GISI,
         INITIAL = 131072,
         NEXT = 131072,
         PCTINCREASE = 0,
         MINEXTENTS = 1,
         MAXEXTENTS = 2147483645,
         BTREE_INITIAL = 512K,
         BTREE_NEXT = 512K,
         BTREE_PCTINCREASE = 0')
    This in turn creates the table
    MYTABLE_SX_HL6N8$
    and
    the indexes
    MYTABLE_SX_HL6N8$_B1
    (x4 - one for each field SDO_GROUPCODE, SDO_CODE, SDO_STATUS, SDO_ROWID)
    and
    MYTABLE_SX_HL6N8$_B2
    (x1 one for SDO_ROWID)
    using the following script:
    DROP TABLE MYTABLE_SX_HL6N8$ CASCADE CONSTRAINTS ;
    CREATE TABLE MYTABLE_SX_HL6N8$ (
    SDO_GROUPCODE RAW (14),
    SDO_ROWID ROWID,
    SDO_CODE RAW (14),
    SDO_STATUS VARCHAR2 (1))
    TABLESPACE GISI
    PCTFREE 10
    PCTUSED 40
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 131072
    NEXT 131072
    PCTINCREASE 0
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    FREELISTS 1 FREELIST GROUPS 1 )
    NOCACHE;
    CREATE INDEX MYTABLE_SX_HL6N8$_B1 ON
    "GIS".MYTABLE_SX_HL6N8$(SDO_GROUPCODE, SDO_CODE, SDO_ROWID, SDO_STATUS)
    TABLESPACE GISI PCTFREE 10 STORAGE(INITIAL 524288 NEXT 524288 PCTINCREASE 0 )
    CREATE INDEX MYTABLE_SX_HL6N8$_B2 ON
    "GIS".MYTABLE_SX_HL6N8$(SDO_ROWID)
    TABLESPACE GISI PCTFREE 10 STORAGE(INITIAL 524288 NEXT 524288 PCTINCREASE 0 )
    The problem is when you create a spatial index using the top script the max # extents do not get applied to
    MYTABLE_SX_HL6N8$_B1
    and
    MYTABLE_SX_HL6N8$_B2
    Instead these tables take on the default max # extents set on the tablespace.
    How do I set the max # extents for indexes
    MYTABLE_SX_HL6N8$_B1
    and
    MYTABLE_SX_HL6N8$_B2
    to MAXEXTENTS 2147483645 for example. I am aware that this is not good practice but I would like to know if it is possible. Is it a spatial issue? I have tried to increase the size of
    the BTREE_INITIAL and BTREE_NEXT to 512K from 128K but it still complains about max # extents (999) reached. A way round it is obviously to increase the default max # extents on the tablespace but that requires DBA intervention. I would like to know how one can do this programatically using the top script or something similar.
    Thanks
    Regards
    Stephen

    Hi Stephen,
    A few thoughts:
    Oracle has pretty much dropped hybrid indexing in terms of it being
    a generically useful way to index data. As of 9.0.1.2 the suggestion
    is to use R-tree indexes unless there is something about your
    workload or data set that makes the use of R-trees bad.
    If you don't use R-tree indexing, then stick with fixed indexing. The
    original idea of hybrid indexing was to allow better approximations
    of geometries without the index growing too large, but it turns out the
    SQL index query within spatial took longer than anticipated.
    In terms of setting up the spatial index, when creating a quadtree index
    you can specify the btree_initial and btree_next in the parameters clause
    of the create index statement, which allows you to adjust the btree indexing
    parameters as you noted, but there is no way to set the max number of
    extents (or in fact the tablespace used for the b-tree indexes).
    When you need that control, you need to to have dba intervention to set the
    default tablespace and parameters at the user level before creating the spatial
    index. The parameters in the parameters clause can set up the index table
    parameters, and the default parameters can be used for the btree indexes.
    regards,
    dan

  • ORA-1631: max # extents 505 reached in table APPLSYS.WF_NOTIFICATION_IN

    Platform: RHEL 4u5
    Application: 11.5.10.2
    Database: 10.2.0.4
    2-node Installation as follows:
    1 Node for DB and Concurrent
    1 Node for Apps.
    We anabled OWF Mailer services on 2nd Sept, and on 5th Sep we started receiving following error messages in our DB alert log contnuously:
    ORA-1631: max # extents 505 reached in table APPLSYS.WF_NOTIFICATION_IN
    So, we stopped the OWF Mailer servcies and Agent Listeners.
    Got a metalink note 152475.1 but confused to alter the table definition as I am of the view that these Oracle Workflow related tables are Oracle Built-in Objects not the custom one.
    So, will it be ok to increase the Maxextents for this table?

    911748 wrote:
    Hi Asif,
    We have actually implemented it on Production now. We just tested the mailer configuration on TEST and when users give go ahead after they tested their scenarios we implemented the same on Production. Can I implement the extents increment activity on production?
    Yes you can.
    Thanks,
    Hussein

  • Max function for table having no rows

    Hi All
    I have a table in which initially no rows. I am running max() function for a column and then wnats to add 1.
    But when no rows there below code in not working
    select max(code) into p_maxCode from cms_codedetails where codetypeid=0;
    p_maxCode:=p_maxCode+1;
    dbms_output.PUT_LINE('p_maxCode: '||p_maxCode);
    result is:
    p_maxCode:
    How can I handle the this to get 1 if no rows in the table .

    Hi !
    Max function in yur case returns NULL and then
    null + <anything> ... is still null
    You can do
    p_maxCode:=nvl(p_maxCode,0)+1;
    or
    select nvl(max(code),0) into p_maxCode from cms_codedetails where codetypeid=0;
    Of course if YOU have decide that null in this case can be treated as 0
    T

  • Too many extents for table on locally managed uniform ASSM tablespace

    Running Oracle 9.2.0.8 on solaris 10, Enterprise edition.
    Tablespace configuration:
    select extent_management, allocation_type, segment_space_management, block_size, initial_extent, next_extent
    from dba_tablespaces
    where tablespace_name = 'PCLARGE';
    LOCAL UNIFORM AUTO 8192 2097152 2097152
    A nightly peoplesoft SQR job inserts and updates the problem table. The job has been in place without change for four years. During that time, the database moved from 8i to 9i, and the tablespace parameters moved to uniform local ASSM. The job selects from a 70 million row table and then updates the target summary table.
    Can somebody help me understand why the number of extents would grow way out of proportion to the number of rows?
    When the row count was 9807427, this table had 233 extents.
    Row count 10759033, table had 501 extents.
    Row count 10764665, table has 1967 extents.
    The table is not analyzed since the system is using RULE. DBMS_SPACE.SPACE_USAGE indicates no extents above the high water mark. Running SELECT name,value FROM v$sysstat WHERE name like '%table%' seems to indicate that chained rows are not a factor, since the row with name "table fetch continued row" returns a small amount of rows.
    Any ideas? Is it possible there is a bug with ASSM that is causing this?
    Unfortunately I don't have detailed extent history information after each nightly run. I just have the 3 data points above.

    Hi Hemant,
    Thanks for your reply! No parallelism was involved in the SQR script.
    Oracle support has pointed me to Metalink Note:469985.1: Sudden Increase in Unformatted Blocks. This behavior matches our symptoms. My company is going to pursue a backport, but in the meantime we may need to move data into tablespaces without ASSM.
    Best regards,
    Ben

  • ORA-01631: max # extents (121) reached!!!

    Please review the following DML and error in response of that command:
    insert into dtcn (area_code, cons_code, dcdat) values(12,12,sysdate);
    ERROR at line 1:
    ORA-01631: max # extents (121) reached in table MNBSYS.DTCN
    There are only two such tables DTCN and DTCN_HISTORY in which we are unable to insert any record because of above error. Following are some reference information of these tables:
    PCT_FREE: 10, PCT_USED: 40 INITIAL_EXTENT: 5242880,
    NEXT_EXTENT: 10240, MIN_EXTENTS: 1, MAX_EXTENTS: 121,
    PCT_INCREASE: 0, FREELIST: 1, TABLESPACE_NAME: MNB_DATA,
    DBUSERNAME: MNBSYS
    It may also be noted that the above statistics are exactly same for number of tables but we are facing the problem with only these two tables. Kindly advise what could be the problem and how can I overcome this...
    Thanks in anticipation...
    Zia Shareef

    Hi,
    This error comes when table reach to his max extents,here table extend upto 121 extents that is his max value so now you have to increase the value of maxextents.
    by
    SQL> alter table <table_name> storage(maxextents unlimited);
    **also set the value of nextextent parameter because currently its define by very low value of 10240
    Kuljeet

  • System maximum max extents....

    Hi,
    I need a clarification about the System maximum max extents...
    The oracle doc "Error messages" about The error code and message "ORA-01631: max # extents (string) reached in table string.string" points out as action:
    "If maxextents is less than the system maximum, raise it. Otherwise, you must recreate with larger initial, next or pctincrease params"
    Which is the system maximum max. extents...??? Is this of database block size???
    Thanks you,
    Sim

    sgalaxy wrote:
    Hi,
    I need a clarification about the System maximum max extents...
    The oracle doc "Error messages" about The error code and message "ORA-01631: max # extents (string) reached in table string.string" points out as action:
    "If maxextents is less than the system maximum, raise it. Otherwise, you must recreate with larger initial, next or pctincrease params"
    Which version of Oracle are you on ? I don't think maxextents has been a problem since 9i.
    In the days when "unlimited extents" had not been introduced and the entire extent map had to fit in the segment header the size of a segment map entry dictated the number of extents that could be listed, so the block size made a big difference. The maximum roughly doubled as you doubled the size of the block. From memory - 2KB blocks gave 121 extents, 4KB gave 248, 8KB gave 505 and 16KB gave 1016 - I don't have any memory of a figure for 32KB blocks.
    But from 9i (at least 9.2) Oracle ignores any maxextents setting you put into the table storage clause and uses "unlimited".
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "For every expert there is an equal and opposite expert"
    Arthur C. Clarke

  • ORA-01631: max # extents (4096)

    Hi
    I received below ORA error for one of my prod table, would like to in which scenario we get the below error and how to investigate why it has occured.
    ORA-01631: max # extents (4096) reached in table DWHSE.F_APS_ORDERS
    Regards

    To hit a maximum extents error on a table you pretty much have to be using dictionary tablespace management. The maximum number of extents defaults based on the block size. If your Oracle version is 8.1 and up all your tablespaces should have been rebuilt as locally managed tablespaces using either auto-allocate or uniform extents. In the case where you have a newer version you should consider creating new tablespaces and moving the objects into them so you can take advantage of modern extent management features.
    If you are running an older release then just take some time to review your object allocation layout to see if for space managment purposes you need to do any re-arranging or storage parameter modification. We used our own version of auto-allocate under 7.x where we had 4 different extent sizes for smaller objects where each size was an even multiple of the smaller sizes. For moderate size and large tables we had uniform extent sizes.
    Good luck.
    HTH -- Mark D Powell --

  • ORA-1631: max # extents  4096

    Hi
    I received below ORA error for one of my prod table, would like to in which scenario we get the below error and how to investigate why it has occured.
    ORA-1631: max # extents 4096 reached in table.......
    Regards

    And what does this database error have in common with Oracle Object and Object Relational concepts, that are the subject matter of this forum?
    Please select the appropriate forum to ask your questions - in this, find the Oracle Database > Database - General forum - and close your thread here.

  • ORA-01658: unable to create INITIAL extent for segment in tablespace

    NEW REPOSITORY INSTALLATION ERROR!!
    I want to install a new Repository using Oracle9iR9.2.0.1 and iDS10g on windowsXP Professional the same machine.
    After running all the SQL scripts ( ckqa,ckvalqa,ckcreate,ckreport) with success to installing a new Repository on my Database using "the Scripts Method",I start the Repository Administration Utility( RAU) to scheck the priveleges and so on.
    After pressing the Install button in the RAU:
    -I take public synonyms
    -I scheck the box for "Support Designer Objects", then
    -The Repository size is Medium
    -I have not change the defauft Tablespace of the Repository_Manager names TEMPORARY_TABLES to store the index and table of System Data....Diagram Data.
    After Starting, the Installation began an stop by installing some Tables like schown :
    Operation: Started : 07/03/04 20:26:32
    Reading File: cktabs.sql
    Object : TABLE CDDL_TMP_TBL
    Executing statement(s)...
    Verifying...
    .and so on till....uns so weiter bis
    Reading File: cktabs.sql
    Object : TABLE RM$INFO
    Executing statement(s)...
    Error Submitting Definition: User intervention required...
    RME-02124: Failed to execute SQL statement: CREATE TABLE RM$INFO
    (NAME VARCHAR2(128) NOT NULL
    ,VALUE VARCHAR2(128)
    Storage (initial 4K next 4K pctincrease 0) Tablespace TEMPORARY_TABLES
    ORA-01658: unable to create INITIAL extent for segment in tablespace TEMPORARY_TABLES
    Dumping Buffer...
    CREATE TABLE RM$INFO
    (NAME VARCHAR2(128) NOT NULL
    ,VALUE VARCHAR2(128)
    ...End of Buffer
    User Requested: Stop Process
    When I read the Help of the Error the
    CAUSE was: Failed to find sufficient contiguous Space to allocate INITIAL extend for Segment being created.
    ACTION: Use ALTER TABLESPACE ADD DATAFILE to add additional space to the tablespace or retry with a smaller Value for initial.
    I then try to resolve it by schecking and changing the Values of INITIAL_VALUE and NEXT_VALUE in the ckparams.txt to 500k.I change the Values of TEMPORARY_TABLES(10214 to 51200k) and TEMPORARY_INDEXES from (20000 to 100000k).Then I run the scripts @ckparams.txt, @ckvalqa, @ckcreate but
    -pressing the Scheck Privileges Button on the RAU still give me 106k for the INITIAL_ and NEXT_VALUE.
    -And the installato still stop with the same Error.
    Question: How schould I resolve this Configuration?
    You could respond in ENGLICH, GERMAN or FRENCH
    Thank you for your Help!

    You are running into database errors. You should refer to the database documentation on how to adjust the size your tablespaces. The online Designer installation guide will advise you as to the sizes of tablespaces you require. (http://otn.oracle.com/pls/wocprod/docs/page/ocom/technology/products/designer/supporting_doc/Des10g_9044/cmnhlp72/rep_insgde/igttl_9i.htm)
    Regards
    Sue

  • How to get all minimum values for a table of unique records?

    I need to get the list of minimum value records for a table which has the below structure and data
    create table emp (name varchar2(50),org varchar2(50),desig varchar2(50),salary number(10),year number(10));
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',3000,2005);
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',4000,2007);
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2007);
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2008);
    insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2010);
    commit;
    SELECT e.name,e.org,e.desig,min(e.year) FROM emp e,(
    SELECT e1.name,e1.org,e1.desig,e1.salary FROM emp e1
    GROUP BY (e1.name,e1.org,e1.desig,e1.salary)
    HAVING COUNT(*) >1) min_query
    WHERE min_query.name = e.name AND min_query.org = e.org AND min_query.desig =e.desig
    AND min_query.salary = e.salary
    group by (e.name,e.org,e.desig);With the above query i can get the least value year where the emp has maximum salary. It will return only one record. But i want to all the records which are minimum compare to the max year value
    Required output
    emp1     org1     mgr     7000     2008
    emp1     org1     mgr     7000     2007Please help me with this..

    Frank,
    Can I write the query like this in case of duplicates?
    Definitely there would have been a better way than the query I've written.
    WITH      got_analytics     AS
         SELECT     name, org, desig, salary, year
         ,     MAX (SALARY)  OVER ( PARTITION BY  NAME, ORG, DESIG)          AS MAX_SALARY
         ,     ROW_NUMBER () OVER ( PARTITION BY  NAME, ORG, DESIG, SALARY
                                    ORDER BY        year  DESC
                           )                              AS YEAR_NUM
           FROM    (SELECT 'emp1' AS NAME, 'org1' AS ORG, 'mgr' AS DESIG, 3000 AS SALARY, 2005 AS YEAR FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',4000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',4000,2008 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2008 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL)
    SELECT     name, org, desig, salary, year
    FROM     got_analytics
    WHERE     salary          = max_salary
    AND     YEAR_NUM     > 1
    Result:
    emp1     org1     mgr     7000     2010
    emp1     org1     mgr     7000     2008
    emp1     org1     mgr     7000     2007
    emp1     org1     mgr     7000     2007
    WITH      got_analytics     AS
         SELECT     name, org, desig, salary, year
         ,     MAX (SALARY)  OVER ( PARTITION BY  NAME, ORG, DESIG)          AS MAX_SALARY
         ,     ROW_NUMBER () OVER ( PARTITION BY  NAME, ORG, DESIG, SALARY
                                    ORDER BY        year  DESC
                           )                              AS YEAR_NUM
      ,     ROW_NUMBER () OVER ( PARTITION BY  NAME, ORG, DESIG, SALARY, Year
                                    ORDER BY        YEAR  DESC
                           )                              AS year_num2
         FROM    (SELECT 'emp1' AS NAME, 'org1' AS ORG, 'mgr' AS DESIG, 3000 AS SALARY, 2005 AS YEAR FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',4000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',4000,2008 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2008 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL UNION ALL
    SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL)
    SELECT     name, org, desig, salary, year
    FROM     got_analytics
    WHERE     salary          = max_salary
    AND     YEAR_NUM     > 1
    AND YEAR_NUM2 < 2
    Result:
    emp1     org1     mgr     7000     2008
    emp1     org1     mgr     7000     2007

  • Creation of sequence and trigger for each table!!!!!!!1

    Hi
    I am new to trigger and Sequence field. In one of my database we have many tables with fields for specifing ID numbers. Iam planning to insert the ID field with help of a Sequence and trigger...that trigger fires by adding the sequence value from the dual table. Now the point is here we r having around *60* table with ID field. And i am planning use the above process for each table by creating sequences and trigger for each table.
    Will this affects the performance of database.
    Is there any other option other than the above process, I mean other than creating sequences and trigger for each table.
    PLzz help to resolve this issuee......
    Shiyas
    Edited by: user13170361 on Jun 7, 2010 12:37 AM

    Tiger, I didn't mind about your comment, but the point is try to use
    select NVL(max(a) + 1,1) into i from p1_temp;This line in your trigger code and see what is happening. The problem is with your trigger. You are using group by function and you will not get no_data_found !
    For more help, this is some modification of your code.
    SQL> create table p1_temp (a number(10) primary key, b number(10));
    Table created.
    SQL> create or replace trigger trg_p1_temp
      2  before insert on p1_temp for each row
      3  declare
      4  i number(10);
      5  begin
      6  begin
      7  select NVL(max(a) + 1,1) into i from p1_temp;
      8  exception
      9  when no_data_found then
    10  i := 1;
    11  end;
    12  :new.a := i;
    13  end;
    14  /
    Trigger created.
    SQL> insert into p1_temp(b) values (1);
    1 row created.
    SQL> insert into p1_temp(b) values (2);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from p1_temp;
             A          B
             1          1
             2          2
    SQL> Edited by: Saubhik on Jun 7, 2010 2:30 AM

  • How to retrieve Min(startDate) and Max(endDate) for different groups of data? (sql server 2000)

    My sample dataset (below) contains 3 groups -- 'a', 'b', 'c'.  I need to retrieve the Min(startDate) and Max(EndDate) for each group so that the output looks something like this (date format not an issue):
    fk   minStart       maxEnd
    a    1/13/1985    12/31/2003
    b    2/14/1986    12/31/2003
    c    4/26/1987    12/31/2002
    What is the Tsql to perform this type of operation?  Note:  the actual data resides in a sql server 2000 DB.  If the Tsql is different between version 2000 and the later versions -- I would be grateful for both versions of the Tsql
    --I noticed that multiple lines of Insert values doesn't work in Sql Server 2000 -- this sample is in Sql Server 2008
    create table #tmp2(rowID int Identity(1,1), fk varchar(1), startDate datetime, endDate datetime)
    insert into #tmp2
    values
    ('a', '1/13/1985', '12/31/1999'),
    ('a', '3/17/1992', '12/31/1997'),
    ('a', '4/21/1987', '12/31/2003'),
    ('b', '2/14/1986', '12/31/2003'),
    ('b', '5/30/1993', '12/31/2001'),
    ('b', '6/15/1994', '12/31/2003'),
    ('b', '7/7/2001', '12/31/2003'),
    ('c', '4/26/1987', '12/31/1991'),
    ('c', '8/14/1992', '12/31/1998'),
    ('c', '9/10/1995', '12/31/2002'),
    ('c', '10/9/1996', '12/31/2000')
    Thanks
    Rich P

    Rich
    It is unclear what you are trying to achieve, you said that it is SQL Server 2000 but provide a sample data with SQL Server 2008 syntax
    Is it possible to use UNION ALL for your queries to make its one 
    select * from
    select * from #tmp2 t1 where exists
    (select * from (select top 1 * from #tmp2 t2 where t2.fk = t1.fk order by t2.startdate) x where x.rowID = t1.rowID)
    UNION ALL
    select * from #tmp2 t1 where exists
    (select * from (select top 1 * from #tmp2 t2 where t2.fk = t1.fk order by t2.Enddate desc) x where x.rowID = t1.rowID)
     as  der order by fk
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for

  • METHOD to get schedule line item in ME_PROCESS_PO_CUST

    Hi all, i am using BADI: ME_PROCESS_PO_CUST. i am using method PROCESS_POST. i am getting header data & item data using some methods. which method i should use to get schedule line data how to find what are the methods are there to get all the PO ope

  • Shared photostream icloud usage

    Hi guys (or girls ;-)), I love the shared photostream, now I can create an album and put some photo's in it and it automatically shows those albums on all my devices without the need to sync them through itunes. Besides that, I can also easily share

  • Tell JVM that it should use both default and custom truststores?

    Coming off [this question|http://forums.sun.com/thread.jspa?threadID=5408453] I have solved my problem by importing the entire cacerts keystore into my truststore along with the special certificates I need for SSL contacts with other remote servers.

  • Olympus Stylus 1 File Format & Camera Raw

    I've just installed Photoshop Elements 12 and the Camera Raw version supplied does not recognise the Olympus Stylus 1 raw file version. I usually use a Canon 5D mk 111 so that raw file format is fine. Does anyone know if the latest version of Adobe C

  • How do you update the schema password from OEM

    How do you update the schema password from Oracle Enterprise Manager...