Add generic partition getting ORA-14020

Hi,
i wrote some test statements, for trying to achiev that.
but now i got an ORA-14020: this physical attribute may not be specified for a table partition
i try to generate a generic partition name with the SYSTIMESTAMP.
the stement i use is:
alter table table_partitioned
add partition table_partitioned_' || ' substr(to_char(systimestamp,'yyyy_mm_dd'),1,10) ' || ' VALUES LESS THAN (TO_DATE('09.05.2013', 'dd.mm.yyyy'));
i can't figure out whats wrong with the syntax, can anybody help me.
thanks for reading :-)
Edited by: user13616920 on 10.05.2012 01:45

sql_stat := 'alter table table_partitioned add partition table_partitioned_' ||
                to_char(systimestamp,'yyyy_mm_dd')|| -- to_char(sysdate,'yyyy_mm_dd')||
                ' VALUES LESS THAN (TO_DATE(''09.05.2013'', ''dd.mm.yyyy''))';Datatype:
http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#i1847
Sysdate:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions172.htm
Systimestamp:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions173.htm
TO_CHAR (datetime):
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions180.htm
set linesize 200
select 'alter table table_partitioned add partition table_partitioned_' ||
            to_char(systimestamp,'yyyy_mm_dd')||
            ' VALUES LESS THAN (TO_DATE(''09.05.2013'', ''dd.mm.yyyy''))' sql_
from dual;
select 'alter table table_partitioned add partition table_partitioned_' ||
        to_char(sysdate,'yyyy_mm_dd')||
         ' VALUES LESS THAN (TO_DATE(''09.05.2013'', ''dd.mm.yyyy''))' sql_
from dual;
SQL_                                                                                                                          
alter table table_partitioned add partition table_partitioned_2012_05_10 VALUES LESS THAN (TO_DATE('09.05.2013', 'dd.mm.yyyy'))
1 row selected.
SQL_                                                                                                                          
alter table table_partitioned add partition table_partitioned_2012_05_10 VALUES LESS THAN (TO_DATE('09.05.2013', 'dd.mm.yyyy'))
1 row selected.

Similar Messages

  • Why Am I Getting ORA-01031: insufficient privileges To Add Trandata?

    I create a table C##TOM.CUSTOMERS in SQL Plus.
    I go to the ggsci command line and attempt to add trandata and get the following insufficient privileges response:
    GGSCI (TPFAEFFL-LAP) 11> add trandata C##TOM.CUSTOMERS
    ERROR: Error (1031, ORA-01031: insufficient privileges) start select in get_total_columns.
    I have already granted connect, dba, flashback, create session, alter session, select any dictionary, select any table, select any transaction, and select unlimited tablespace to the user.
    What privileges am I missing?
    TIA.

    Did you use the DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE procedure to the DBLOGIN user?  
    This call grants all of the required privileges for ADD SCHEMATRANDATA and ADD TRANDATA - whether it is classic or integrated capture.  

  • Error ORA-14020

    Hi,
    I am trying to Add/Drop partition at runtime and using following command
    declare
    abc varchar2(5000);
    begin
    abc:= 'ALTER TABLE OL00.T_CUST_ITEM ADD PARTITION P_'||to_char(sysdate,'YYMMDD')||' VALUES LESS THAN'||CHR(10)||
    ' (to_date('''||' '||to_char(sysdate+1,'YYYY-MM-DD')||' 00:00:00'''||', '||'''SYYYY-MM-DD HH24:MI:SS'''||', '
    ||'''NLS_CALENDAR=GREGORIAN'''||'))'|| CHR(10)||
    'tablespace TSP_ADDCHGDEL_0 ' || CHR(10)|| '/';
    dbms_output.put_line(abc);
    execute immediate abc;
    end;
    /but I am geeting following error
    Error at line 1
    ORA-14020: this physical attribute may not be specified for a table partition
    ORA-06512: at line 9
    Script Terminated on line 1also when I try to drop partition, I am getting error
    declare
    abc varchar2(500);
    begin
    abc := 'ALTER TABLE OL00.T_CUST_ITEM_ADDDEL_ELA' ||chr(10)|| 'DROP PARTITION P_'||to_char(sysdate,'YYMMDD')||chr(10)||
    dbms_output.put_line(abc);
    execute immediate abc;
    end;
    /Any Idea why I am geeting problem in same.

    ORA-14020: this physical attribute may not be specified for a table partition
    Cause: unexpected option was encountered while parsing physical attributes of a table partition; valid options for Range or Composite Range partitions are INITRANS, MAXTRANS, TABLESPACE, STORAGE, PCTFREE, and PCTUSED; only TABLESPACE may be specified for Hash partitions
    Action: remove invalid option(s) from the list of physical attributes of a table partition

  • I am getting "ORA-00900: invalid SQL statement"  error.?

    I did installed oracle 11gR2. and used "DBMS_METADATA_DIFF.COMPARE_ALTER('TABLE','TBL_A','TBL_A','USER1','USER2')"   to see the result like below,  but I am getting "ORA-00900: invalid SQL statement"  error.   Any idea?
    I am using:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> desc user1.tbl_a
    Name                                      Null?    Type
    FIELD_A1                                  NOT NULL NUMBER
    FIELD_A2                                           VARCHAR2(20)
    FIELD_A4                                  NOT NULL NUMBER(5,2)
    FIELD_A5                                           VARCHAR2(10)
    FIELD_A6                                  NOT NULL NUMBER(2)
    SQL> desc user2.tbl_a
    Name                                      Null?    Type
    FIELD_A1                                  NOT NULL NUMBER
    FIELD_A2                                           VARCHAR2(50)
    FIELD_A3                                           DATE
    FIELD_A4                                           NUMBER(5,2)
    FIELD_A5                                  NOT NULL VARCHAR2(10)
    SQL> select dbms_metadata_diff.compare_alter('TABLE','TBL_A','TBL_A','USER1','USER2') from dual
    expected result:
    DBMS_METADATA_DIFF.COMPARE_ALTER('TABLE','TBL_A','TBL_A','U1','U2')
    ALTER TABLE "U1"."TBL_A" ADD ("FIELD_A3" DATE)
      ALTER TABLE "U1"."TBL_A" DROP ("FIELD_A6")
      ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A2" VARCHAR2(50))
      ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A4" NUMBER(5,2) DEFAULT 0)
      ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A4" NULL)
      ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A5" NOT NULL ENABLE)

    Thanks for reply rp,
    I got result using "select dbms_metadata_diff.compare_alter('TABLE','TBL_A','TBL_A','USER1','USER2') from dual"

  • Getting ORA-32700 while creating database

    I am getting following error when creating the database :
    ORA-32700 error occurred in DIAG Group Service
    The error description is as follows :
    Cause: An unexpected error occurred while performing a DIAG Group Service operation.
    Action: Verify that the DIAG process is still active. Also, check the Oracle DIAG trace files for errors.
    The setup is as follows :
    Database : Oracle 9i Rel 2.
    OS : IBM AIX 4.3.3
    We are trying to create the database from sqlplus/dbca. It seems that in the database creation process it is throwing the error while it is trying to create the control files.
    listener.ora :
    LSNR_TSEDMDB2 =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = prcsmbk1)(PORT = 1522))
    TNSNAMES.ORA
    LISTENER_TSEDMDB2 =
    (ADDRESS = (PROTOCOL = TCP)(HOST = prcsmbk1)(PORT = 1522))
    We have IBM HACMP Cluster setup on 3 machines. This machine (prcsmbk1) on which I am getting the error while creating the database is part of that HACMP cluster. While installing the Oracle database software also it gave me a list of the 3 machines which are in HACMP cluster. We are not planning to setup RAC, but still it seems like while creating the database control files Oracle is trying to perform some group service operation.
    Alert log :
    Sat Jan 3 03:31:18 2004
    Starting ORACLE instance (normal)
    Sat Jan 3 03:31:18 2004
    Global Enqueue Service Resources = 64, pool = 4
    Sat Jan 3 03:31:18 2004
    Global Enqueue Service Enqueues = 128
    LICENSE_MAX_SESSION = 0
    LICENSE_SESSIONS_WARNING = 0
    GES IPC: Receivers 1 Senders 1
    GES IPC: Buffers Receive 1000 Send 530 Reserve 300
    GES IPC: Msg Size Regular 432 Batch 2048
    SCN scheme 3
    Using log_archive_dest parameter default value
    LICENSE_MAX_USERS = 0
    SYS auditing is disabled
    Starting up ORACLE RDBMS Version: 9.2.0.4.0.
    System parameters with non-default values:
    processes = 150
    timed_statistics = TRUE
    shared_pool_size = 117440512
    large_pool_size = 16777216
    java_pool_size = 117440512
    control_files = /u01/app/oracle/oradata/TSEDMDB2/control01.ctl
    db_block_size = 8192
    db_cache_size = 33554432
    compatible = 9.2.0.0.0
    db_file_multiblock_read_count= 16
    fast_start_mttr_target = 300
    undo_management = AUTO
    undo_tablespace = UNDOTBS1
    undo_retention = 10800
    remote_login_passwordfile= EXCLUSIVE
    db_domain =
    instance_name = TSEDMDB2
    dispatchers = (PROTOCOL=TCP) (SERVICE=TSEDMDB2XDB)
    local_listener = LISTENER_TSEDMDB2
    job_queue_processes = 10
    hash_join_enabled = TRUE
    background_dump_dest = /u01/app/oracle/admin/TSEDMDB2/bdump
    user_dump_dest = /u01/app/oracle/admin/TSEDMDB2/udump
    core_dump_dest = /u01/app/oracle/admin/TSEDMDB2/cdump
    sort_area_size = 524288
    db_name = TSEDMDB2
    open_cursors = 300
    star_transformation_enabled= FALSE
    query_rewrite_enabled = FALSE
    pga_aggregate_target = 25165824
    aq_tm_processes = 1
    Sat Jan 3 03:31:19 2004
    clUster interconnect IPC version:Oracle UDP/IP
    IPC Vendor 1 proto 2 Version 1.0
    PMON started with pid=2
    DIAG started with pid=3
    LMON started with pid=4
    LMD0 started with pid=5
    DBW0 started with pid=6
    LGWR started with pid=7
    CKPT started with pid=8
    SMON started with pid=9
    RECO started with pid=10
    CJQ0 started with pid=11
    QMN0 started with pid=12
    Sat Jan 3 03:31:24 2004
    starting up 1 shared server(s) ...
    starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
    Sat Jan 3 03:31:25 2004
    Create controlfile reuse set database TSEDMDB2
    MAXINSTANCES 1
    MAXLOGHISTORY 1
    MAXLOGFILES 50
    MAXLOGMEMBERS 5
    MAXDATAFILES 100
    Datafile
    '/u01/app/oracle/oradata/TSEDMDB2/cwmlite01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/drsys01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/example01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/indx01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/odm01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/system01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/tools01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/undotbs01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/users01.dbf' ,
    '/u01/app/oracle/oradata/TSEDMDB2/xdb01.dbf'
    LOGFILE GROUP 1 ('/u01/app/oracle/oradata/TSEDMDB2/redo01.log') SIZE 102400K,
    GROUP 2 ('/u01/app/oracle/oradata/TSEDMDB2/redo02.log') SIZE 102400K,
    GROUP 3 ('/u01/app/oracle/oradata/TSEDMDB2/redo03.log') SIZE 102400K RESETLOGS
    Sat Jan 3 03:31:25 2004
    ORA-1503 signalled during: Create controlfile reuse set database TSEDMDB2
    MAX...
    Sat Jan 3 03:32:28 2004
    Restarting dead background process QMN0
    QMN0 started with pid=15
    Sat Jan 3 03:32:28 2004
    Shutting down instance (abort)
    License high water mark = 3
    Instance terminated by USER, pid = 47128
    Diag trace file :
    /u01/app/oracle/admin/TSEDMDB2/bdump/tsedmdb2_diag_49754.trc
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.4.0 - Production
    ORACLE_HOME = /u01/app/oracle/product/9.2.0
    System name: AIX
    Node name: prcsmbk1
    Release: 3
    Version: 4
    Machine: 0002599F4C00
    Instance name: TSEDMDB2
    Redo thread mounted by this instance: 0 <none>
    Oracle process number: 0
    49754
    Number of Serviceable Networks detected is less than 2
    Disabling Transparent Network Failover Feature.
    *** SESSION ID:(2.1) 2004-01-03 03:31:19.886
    kjzcprt:rcv port created
    kjzmreg2: slos err[1 19 [HA_GS_CONNECT_FAILED] sskgxn_gs_in 19]
    [kjzmreg2]: Error [category=1] is encountered
    Node monitor problem:[32700][kjzmreg2]
    Membership is lost in DIAG group
    Any help is appreciated. Thanks in advance.

    Thanks a lot for all your responses. We found the issue. The issue was that when we installed 9i we selected Enterprise option which installed RAC also. And after that when we were trying to create database Oracle was thinking that we are trying to create database in RAC env. and most likely it was trying to create/sync the control files on all the machines in the cluster.
    The sequence of events were as below :
    1. We have 8i installed on this machine
    2. We installed 9i (9.2.0.1.0) using the same ORACLE_BASE but different ORACLE_HOME. We didn't select "Custom Install". We selected "Enterprise install" option
    3. We installed new installer (2.2.0.18.0 ) and then 9i patch (9.2.0.4.0)
    4. While creating the database (manually & through DBCA) we were getting ORA-32700
    5. We tried to uninstall (using OUI 2.2.0.18.0) 9i (including the patch) completely but it never succeeded. We noticed that when we started uninstall it did show progress for about 20 minutes and after that it didn't show any progress. It was not taking any CPU cycles and It was not writing to the log file either. Basically we were never able to cleanly uninstall 9i. We tried almost 2 to 3 times.
    6. Then we installed 9i using a new ORACLE_BASE and this time we selected "Custom Install" and we did not install RAC. This is successful
    7. Then we installed new installer (2.2.0.18.0 ) and we tried to install the 9i patch (9.2.0.4.0) using this new installer but it never succeeded. Then we tried to install the 9i patch (9.2.0.4.0) using the old installer version (2.2.0.11.0) and it was also successful.
    8. Then we tried to create database using DBCA and it was successful and then we dropped the database which was created using DBCA and then we created it manually through SQLPLUS and this was fine too.
    So basically what we learned from this exercise is that if we are installing 9i on a machine which is part of a cluster and if we don't plan to setup RAC then we shouldn't install RAC and we should do a custom install. I wish there was a option in create database stmt to tell Oracle that though we are creating database on a machine which is part of a cluster environment but we don't intend to setup RAC.
    And other thing which is still a mystery is that why does the uninstall never completes successfully. One question on this : We were using the installer version 2.2.0.18.0 to uninstall the 9i software. Do we need to use the older version (2.2.0.11.0) of the OUI?

  • [b]desc table_name gets ORA-03113: end-of-file on communication channel[/b]

    My installation running on Windows 2000 Oracle9i. When issue desc table_name i get ORA-03113: end-of-file on communication channel. I have set processes = 300 in parameter file.

    The ORA-03113: end-of-file on communication channel error is a generic error. The ORA-03113 error when connecting suggests that the connection was established, but lost later, like a timeout.
    There are many possible causes for the ORA-03113 error. See MetaLink Note:17613.1 "ORA-03113":
    For example, ORA-3113 could be signaled for any of these scenarios:
    - Server machine crashed
    - Your server process was killed at O/S level
    - Network problems
    - Oracle internal errors / aborts on the server
    - Client incorrectly handling multiple connections
    - etc.. etc.. etc.. - a lot of possible causes !!
    It goes on to note that the ORA-03113 End-Of-File error often has additional messages:
    It is common for this error to be accompanied by other errors such as:
    - ORA-1041 internal error. hostdef extension doesn't exist
    - ORA-3114 not connected to ORACLE
    - ORA-1012 not logged on
    To find more details, check for a trace file in your USER_DUMP_DEST and BACKGROUND_DMP_DEST directory.
    Hope this helps . . .
    Donald K. Burleson
    Oracle Press author
    Author of "Oracle Tuning: The Definitive Reference"
    http://www.rampant-books.com/book_2005_1_awr_proactive_tuning.htm

  • Getting ORA-01031: insufficient privileges if try to connect in sqlplus

    Hi,
    I've tried to connect to my db which stands at host (Solaris), but getting
    ORA-01031: insufficient privileges.
    The client I've used is sqlplus.
    SQL> conn sys@REP as sysdba
    ERROR:
    ORA-01031: insufficient privileges
    At the same time I can successfully connect to the same db from the same PC with the same connection string at PL/SQL Developer.
    How it can be possible?

    Guys...
    I'm having the same problem.
    The platform is a Windows 2003 R2 64bit (SP2) with Oracle 11g.
    In the production server from the same client, the connection is usually ... however, to a server where I have the same instances retrieved from an RMAN backup, does not connect!
    In the Productoion Server:
    C:\>sqlplus sys@bmknfe as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 18 17:43:41 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
    In the Recovered Server:
    C:\>sqlplus sys@bmknfe_rt as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 18 17:42:39 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Enter password:
    ERROR:
    ORA-01031: insufficient privileges
    I've tried recreating the password file, but is not resolving ...
    Can someone give me a light?

  • Disk Utility won't add new partition

    I have an external 250GB hard drive connected via USB to my Mac Mini (Early 2009) computer. The drive has a GUID partition table that was created using Windows Vista SP 1. The first partition on the disk is a 128MB Microsoft Reserved partition. The second partition is a 120GB NTFS partition. When I try to use Disk Utility to partition the remaining 112GB of space as a Mac OS Extended Journaled partition I keep getting an error message stating "MediaKit reports no such partition". How do I get around this bug in Apple's Disk Utility application?

    techguy378,
    As they always do, Microsoft has undoubtedly created "their own" proprietary implementation of the GUID partition table. The effect, in this particular case, is that Disk Utility cannot see that unused space. That doesn't mean this is a Disk Utility "bug."
    If one were to do the same thing with Disk Utility- create 2 partitions on a drive that do not fill the drive- that empty space would be included in the partition map. Simple. In your case, however, it appears that Vista has just excluded that empty space from the map entirely. Neat trick, huh?
    I think your only solution will be to add a partition in Vista, if that is possible without destroying the current volumes. You can then reformat the new partition in Disk Utility.
    Scott

  • When I try to partition my hardrive to add a windows partitiation it says I can't because the boot program is running, what to do to solve this issue so I can add a partition?

    I don't understand why a boot program is preventing me to add a windows partition so I can add Windows to it. This happens everytime I try to add a partition, can someone help me solve this issue, please? I don't know why it won't let me add a partition to install windows on it.
    V/r
    Scarar

    Once you have obtained an external drive and connected it you will 'clone' your internal drive to it.
    Download Carbon Copy Cloner (it is not free but there is a fully functional trial version which is). Use it to clone your internal drive to your external drive. When that is done you will reboot from the clone and use Disk Utility to erase the internal drive (choose Mac OS Extended (Journaled)) as the format (this is normally preset, but check). Make sure to give the external drive a 'distinctive' name, don't want to get drives mixed up in this process.
    Once that is done you will use Carbon Copy Cloner (from the clone) to restore the external to the internal.

  • Add New partition

    Hello,
    Oracle 11.2.0.1
    Windows
    I am having one partitioned IOT something like this :
    create table my_table (
    col1 number(10) not null,
    col2 varchar2(7) not null,
    col3 varchar2(20) not null,
    col4 varchar2(20) not null,
    col5 varchar2(20) not null,
    col6 date not null,
    col7 number(4) not null,
    col8 varchar2(1) not null,
    col9 varchar2(1) not null,
    primary key(col1,col2,col3,col4,col5,col6,col7,col8,col9)
    organization index
    partition by range (col3,col4,col5)
    (partition p1 values less than('A%','A%','A%'),
    partition p2 values less than('B%','B%','B%'),
    partition p3 values less than('C%','C%','C%'),
    PARTITION p27 VALUES LESS THAN (MAXVALUE,MAXVALUE,MAXVALUE))
    Now, I want to add new range partition on column col7. There is an index exist on col7 too, but since table is carrying around 200 million rows, only having index is not looking good, so I thought to add similar type of partition on col7. In col7 there are range value between 2000 to 2010 only.
    Kindly tell me how do I proceed to add new partition on another column of existing partitioned IOT please.
    Thanks.

    i thought that I am having the data of all student_name, father_name and mother_name whose name starts from A in partition p2 (because B is less than A) and like wise upto Z. Am I clear this ? I mean, if I says a student whose name is Boby John (partition p3), father name Robert (partition p19) and mother name Lilly (partition p13) ?A row can be in exactly one partition. It can't be in three different partitions. If you want to create 26*26*26 partitions, then you could have a separate partition for each possible combination. If you want just 26 partitions, you would realistically only want to partition by one column (presumably student_name).
    select * from my_table where student_name like '%Boby%' and father_name like '%Robert%' and mother_name like '%Lilly%' and passing_year=2001. This would prevent Oracle from doing any sort of partition pruning since you're looking for a string anywhere within the name. You'd be better off not partitioning the table at all if you want to run this sort of query. You'd be much better off using Oracle Text and turning your LIKE conditions into CONTAINS conditions.
    So, I think oracle is using 3 partitions i.e. P3 for Boby, P19 for Robert and P13 for Lilly. Upto this query is running fine and very good, no issue of slowness, but when ever query gets year=something other than 2001, it takes time. So, I thought I should have partitions on passing_year column too.No. A row exists in exactly 1 partition. Oracle has to scan all 26 partitions to satisfy this query. It would be more efficient not to partition the table at all. Even if you created 26*26*26*10 partitions, Oracle would still have to scan 26*26*26 partitions since passing_year is the only predicate on which you could do partition pruning. But that is unlikely to be useful-- you'd almost certainly be better off with no partitioning.
    Justin

  • Getting ORA-01403:, when it shouldn't

    Greetings, i apologize beforehand for my spelling, name(takes 6 hours to change) and the headache you migth get, however,
    i bring you the following code, and test results:
    ------Procedure wich throws the error-------
    create or replace
    procedure P_COLEGAS(x in number) as
    ctipo varchar2(20);
    asd varchar2(20);
    cursor curnombre is
    select nombre from unidad,elemento where (elemento.id_elem=unidad.id_elem and unidad.tipo=ctipo and elemento.ciudad=asd);
    begin
    select unidad.tipo, elemento.ciudad into ctipo,asd from unidad,elemento where unidad.id_elem=x and elemento.id_elem=x;
    for blah in curnombre loop
    DBMS_OUTPUT.PUT_LINE('nombre unidad: '||blah.nombre||' ');
    end loop;
    end;
    -what i get when executing the procedure-
    Error que empieza en la línea 1 del comando:
    exec p_colegas(19)
    Informe de error:
    ORA-01403: no data found
    ORA-06512: at "BD00.P_COLEGAS", line 9
    ORA-06512: at line 1
    01403. 00000 - "no data found"
    *Cause:
    *Action:-----------------------------------------------------------
    -----------------the real problem--------------------
    if in that procedure i were to write
    (1)
    select unidad.tipo into ctipo from unidad where unidad.id_elem=x;(2)
    select elemento.ciudad into asd from elemento where elemento.id_elem=x;instead the single query i wrote, we get the following:
    (1) works wonderfull, only gets the error when there are no matches for x.
    (2) throws the error i showed before.
    however when i do the following query in the worksheet and execute it:
    (3)
    select elemento.ciudad from elemento where elemento.id_elem=x;i get what i expected to get 1 row 1 column.(yes it has data)
    note: in (3) the only difference is that i remove the into clause, and x is the same number i used when i execute the procedure.
    --------------------the question------------------------
    why in the procedure, the query (2) fail to fetch the data, the same data wich the query(3) does not fail to fetch?
    i'm getting ORA-01403, when i shouldn't?
    is there a work around to this problem?
    --------------------what i try------------------------------
    nested the query with it's own error handle exception, getting the same results, just catches the error with a different handling.
    tool used: sql developer
    -Example data--
    tested the procedure with the following example data in a brand new workspace getting the same error.
    --  DDL for Table ELEMENTO
      CREATE TABLE "ELEMENTO"
       (     "ID_ELEM" NUMBER,
         "CIUDAD" VARCHAR2(20),
         "TIPO" CHAR(1),
         "X" NUMBER,
         "Y" NUMBER,
         "FECHAHORA_CREACION" TIMESTAMP (6)
    --  DDL for Table UNIDAD
      CREATE TABLE "UNIDAD"
       (     "ID_ELEM" NUMBER,
         "PORCENTAJE_SALUD" NUMBER,
         "NOMBRE" VARCHAR2(20),
         "TIPO" VARCHAR2(20)
    REM INSERTING into ELEMENTO
    SET DEFINE OFF;
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (12,'Infernalia','U',10,10,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (15,'Infernalia','U',10,7,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (19,'Infernalia','U',15,9,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (23,'Infernalia','U',16,8,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (27,'Infernalia','C',15,10,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (52,'Humania','U',26,10,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (58,'Humania','U',24,9,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (62,'Humania','U',27,11,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (64,'Humania','C',25,8,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (78,'GruntVille','U',47,32,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (84,'GruntVille','U',42,28,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (89,'GruntVille','U',43,29,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (91,'GruntVille','C',44,37,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (29,'Infernalia','C',16,7,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (90,'GruntVille','U',49,36,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    REM INSERTING into UNIDAD
    SET DEFINE OFF;
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (12,100,'Grang','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (15,100,'Krout','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (19,100,'Warf','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (23,100,'Puaj','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (52,100,'Marcelus','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (58,100,'Claudius','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (62,100,'Arturius','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (78,100,'Klaknot','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (84,100,'Staisht','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (89,100,'Bjorkson','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (90,100,'Sknot','Médico');
    --  Constraints for Table ELEMENTO
      ALTER TABLE "ELEMENTO" ADD CONSTRAINT "ELEMENTO_CHK1_TIPO" CHECK (TIPO IN ('U', 'C')) ENABLE;
      ALTER TABLE "ELEMENTO" ADD CONSTRAINT "ELEMENTO_PK" PRIMARY KEY ("ID_ELEM") ENABLE;
      ALTER TABLE "ELEMENTO" MODIFY ("ID_ELEM" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("CIUDAD" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("TIPO" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("X" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("Y" NOT NULL ENABLE);
      ALTER TABLE "ELEMENTO" MODIFY ("FECHAHORA_CREACION" NOT NULL ENABLE);
    --  Constraints for Table UNIDAD
      ALTER TABLE "UNIDAD" MODIFY ("ID_ELEM" NOT NULL ENABLE);
      ALTER TABLE "UNIDAD" MODIFY ("PORCENTAJE_SALUD" NOT NULL ENABLE);
      ALTER TABLE "UNIDAD" MODIFY ("NOMBRE" NOT NULL ENABLE);
      ALTER TABLE "UNIDAD" MODIFY ("TIPO" NOT NULL ENABLE);
      ALTER TABLE "UNIDAD" ADD CONSTRAINT "UNIDAD_PK" PRIMARY KEY ("ID_ELEM") ENABLE;
    --  Ref Constraints for Table ELEMENTO
    --  Ref Constraints for Table UNIDAD
      ALTER TABLE "UNIDAD" ADD CONSTRAINT "UNIDAD_ELEMENTO_FK1" FOREIGN KEY ("ID_ELEM")
           REFERENCES "ELEMENTO" ("ID_ELEM") ENABLE;
    /Edited by: 975362 on 06-12-2012 04:47 AM
    Edited by: BluShadow on 06-Dec-2012 12:51
    added {noformat}{noformat} tags for readability of code/data.  Please read {message:id=9360002} and learn to do this yourself in future.
    Edited by: 975362 on 06-12-2012 05:44 AM
    added example data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Oops, I mi9ssed table ELEMENTO has column X. When you use:
    where unidad.id_elem=x and elemento.id_elem=x;column names take precedence over PL/SQL variables wnd X is resolved as table ELEMENTO column X. not as PL/SQL procedure parameter X. Change PL/SQL procedure parameter name:
    SQL> create or replace
      2  procedure P_COLEGAS(x in number) as
      3  ctipo varchar2(20);
      4  asd varchar2(20);
      5  
      6  cursor curnombre is
      7  select nombre from unidad,elemento where (elemento.id_elem=unidad.id_elem and unidad.tipo=ctipo
    and elemento.ciudad=asd);
      8  
      9  begin
    10  select unidad.tipo, elemento.ciudad into ctipo,asd from unidad,elemento where unidad.id_elem=x
    and elemento.id_elem=x;
    11  for blah in curnombre loop
    12  DBMS_OUTPUT.PUT_LINE('nombre unidad: '||blah.nombre||' ');
    13  end loop;
    14  end;
    15  /
    Procedure created.
    SQL> exec p_colegas(19)
    BEGIN p_colegas(19); END;
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at "SCOTT.P_COLEGAS", line 9
    ORA-06512: at line 1
    SQL> create or replace
      2  procedure P_COLEGAS(p_x in number) as
      3  ctipo varchar2(20);
      4  asd varchar2(20);
      5  
      6  cursor curnombre is
      7  select nombre from unidad,elemento where (elemento.id_elem=unidad.id_elem and unidad.tipo=ctipo
    and elemento.ciudad=asd);
      8  
      9  begin
    10  select unidad.tipo, elemento.ciudad into ctipo,asd from unidad,elemento where unidad.id_elem=p_
    x and elemento.id_elem=p_x;
    11  for blah in curnombre loop
    12  DBMS_OUTPUT.PUT_LINE('nombre unidad: '||blah.nombre||' ');
    13  end loop;
    14  end;
    15  /
    Procedure created.
    SQL> exec p_colegas(19)
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Requesting help-On a report Getting ora-00920 invalid relational operator.

    Hi everyone,
    I am having a report region with the following query:
    select CASE
    WHEN ISITRECENTADDENDUM(meckey_fk,code)
    THEN
    '<a href="javascript:popUp2('''
                   || 'f?p=&APP_ID.:61:&SESSION.::NO::P61_MECKEY_FK:'
                   || &P60_MECKEY.
                   || ''', 700, 700);">'
    || '<img src="#IMAGE_PREFIX#gobut.gif">'
    || '</a>'
    ELSE NULL
    END EditAddendum,
    '<a href="javascript:popURL('''
                   ||'&REPORTS_URL.keynewmec&P_1=&P60_MECNUM.'
                   || ''', 700, 700);">'
    || '<img src="#WORKSPACE_IMAGES#printer.jpg">'
    || '</a>'
    PrintMEC,
    "CODE",
    "MECKEY_FK",
    "ADDENDUM",
    "WHO_CREATED",
    "WHEN_CREATED"
    from "C_ADDENDUMS"
    where "MECKEY_FK" = v('P60_MECKEY')
    And my function returning boolean is as follows:
    create or replace FUNCTION "ISITRECENTADDENDUM"
    (meckeyi in number,
    codei in varchar2)
    return Boolean
    is
    x varchar2(1);
    begin
    select max(code) into x from c_addendums where meckey_fk = meckeyi;
    if x = codei then
    return true;
    else
    return false;
    end if;
    exception
    when others then
    return FALSE;
    end;
    But I am getting ORA-00920 invalid relational operator. Can anyone please help me out? I am not knowing where the error is. When I run the function by itself I am getting "False" returned as expected. Appreciate any advice on this.
    Rgds,
    Suma.

    Suma,
    It looks like what you are trying to do is display a link for the record with the highest value in the Code column, and nothing for the other records.
    If that is the case, you can eliminate the function and just use a SQL query like this:
    (not tested)
    select CASE
              WHEN code = Max(code) over (partition by meckey_fk)
                 THEN
                   '<a href="#">'
                   || ' '
                   || '< img class="TargetAlertIcon" src="chrome://targetalert/content/skin/internal.png"></a>'
              ELSE NULL
           END EditAddendum,
           '<a href="#">'
           || ' '
           || '< img class="TargetAlertIcon" src="chrome://targetalert/content/skin/internal.png"></a>' PrintMEC,
           "CODE", "MECKEY_FK", "ADDENDUM", "WHO_CREATED", "WHEN_CREATED"
      from "C_ADDENDUMS"
    where "MECKEY_FK" = :P60_MECKEYIs that what you're trying to do?
    Doug

  • PRIMARY KEY PARTITIONED INDEXES 생성방법 (ORA-2429, ORA-1408)

    제품 : ORACLE SERVER
    작성날짜 : 2004-08-13
    PRIMARY KEY PARTITIONED INDEXES 생성방법 (ORA-2429, ORA-1408)
    ============================================================
    PURPOSE
    primary key partitioned indexes 를 생성하는 방법을 알아 봅니다.
    SCOPE
    Oracle Partitioning Option은 8~10g Standard Edition에서는 지원하지
    않는다.
    Example:
    SQL> -- 먼저 partitioned table TEST_A 를 생성합니다.
    SQL>
    SQL> CREATE TABLE test_a (col1 number, col2 number, col3 varchar2(20))
    2 PARTITION BY RANGE (col1, col2)
    3 (partition part_test_a_1 values less than (10, 100),
    4 partition part_test_a_2 values less than (20, 200),
    5 partition part_test_a_3 values less than (30, 300),
    6 partition part_test_a_4 values less than (40, 400));
    Table created.
    SQL> -- partitioned table TEST_B 를 생성합니다.
    SQL>
    SQL> CREATE TABLE test_b (col1 number, col2 number, col3 varchar2(20))
    2 PARTITION BY RANGE (col1, col2)
    3 (partition part_test_b_1 values less than (10, 100),
    4 partition part_test_b_2 values less than (20, 200),
    5 partition part_test_b_3 values less than (30, 300),
    6 partition part_test_b_4 values less than (40, 400));
    Table created.
    SQL> -- TEST_A 테이블에
    SQL> -- non-unique local partitioned index, IX_TEST_A 를 생성합니다.
    SQL>
    SQL> CREATE INDEX ix_test_a ON test_a(col1, col2)
    2 LOCAL
    3 (partition ix_test_a_1,
    4 partition ix_test_a_2,
    5 partition ix_test_a_3,
    6 partition ix_test_a_4);
    Index created.
    SQL> -- TEST_B 테이블에
    SQL> -- unique global partitioned index, IX_TEST_B 를 생성합니다.
    SQL>
    SQL> CREATE UNIQUE INDEX ix_test_b1 ON test_b(col1, col2)
    2 GLOBAL PARTITION BY RANGE (col1, col2)
    3 (partition ix_test_b1_1 values less than (20, 200),
    4 partition ix_test_b1_2 values less than (maxvalue, maxvalue));
    Index created.
    SQL> -- TEST_A 테이블에 rimary key constraint (PK_TEST_A) 를 추가 합니다.
    SQL>
    SQL> ALTER TABLE test_a ADD CONSTRAINT pk_test_a
    2 PRIMARY KEY (col2, col1);
    Table altered.
    SQL> -- index IX_TEST_A 를 drop 하려고 하면 다음 에러가 발생합니다.
    SQL>
    SQL> DROP INDEX ix_test_a;
    drop index ix_test_a
    ERROR at line 1:
    ORA-02429: cannot drop index used for enforcement of unique/primary key
    SQL> -- TEST_B 테이블에 partition IX_TEST_B1 에서 사용된 같은 columns 들을 사용해서
    SQL> -- 새로운 두번째 index (IX_TEST_B2) 를 생성하려고 하면
    SQL> -- 다음 에러가 발생합니다.
    SQL>
    SQL> CREATE INDEX ix_test_b2 ON test_b(col1, col2)
    2 LOCAL;
    create index ix_test_b2 on test_b(col1, col2)
    ERROR at line 1:
    ORA-01408: such column list already indexed
    SQL> -- TEST_B 테이블에 primary key constraint (PK_TEST_B) 를 추가 합니다.
    SQL>
    SQL> ALTER TABLE test_b ADD CONSTRAINT pk_test_b
    2 PRIMARY KEY (col1, col2);
    Table altered.
    SQL> -- index IX_TEST_B1 를 drop 하려고 하면 다음 에러가 발생합니다.
    SQL>
    SQL> DROP INDEX ix_test_b1;
    drop index ix_test_b1
    ERROR at line 1:
    ORA-02429: cannot drop index used for enforcement of unique/primary key
    SQL> -- indexes 들과 각 indexes 이 걸려있는 tables 의 목록입니다.
    SQL>
    SQL> SELECT index_name, partition_name, status
    2 FROM user_ind_partitions
    3 ORDER BY index_name, partition_name;
    INDEX_NAME PARTITION_NAME STATUS
    IX_TEST_A IX_TEST_A_1 USABLE
    IX_TEST_A IX_TEST_A_2 USABLE
    IX_TEST_A IX_TEST_A_3 USABLE
    IX_TEST_A IX_TEST_A_4 USABLE
    IX_TEST_B1 IX_TEST_B1_1 USABLE
    IX_TEST_B1 IX_TEST_B1_2 USABLE
    6 rows selected.
    SQL> -- TEST_A 테이블에서 primary key constraint 를 drop 합니다.
    SQL>
    SQL> ALTER TABLE test_a DROP CONSTRAINT pk_test_a;
    Table altered.
    SQL> -- TEST_B 테이블에서 primary key constraint 를 drop 합니다.
    SQL>
    SQL> ALTER TABLE test_b DROP CONSTRAINT pk_test_b;
    Table altered.
    SQL> -- indexes 들과 각 indexes 이 걸려있는 tables 의 목록을 다시 봅니다.
    SQL> -- 여기서 주의해서 보아야 할 것은 non-unique local partitioned index (IX_TEST_A)
    SQL> -- 은 drop 되지 않고 USABLE 상태로 남아 있다는 것입니다.
    SQL> -- 이렇게 되는 이유는 index (IX_TEST_A) 가 non-unique 이기 때문입니다.
    SQL> -- 반면 unique global partitioned index (IX_TEST_B) 은 drop 되었습니다.
    SQL>
    SQL> SELECT index_name, partition_name, status
    2 FROM user_ind_partitions
    3 ORDER BY index_name, partition_name;
    INDEX_NAME PARTITION_NAME STATUS
    IX_TEST_A IX_TEST_A_1 USABLE
    IX_TEST_A IX_TEST_A_2 USABLE
    IX_TEST_A IX_TEST_A_3 USABLE
    IX_TEST_A IX_TEST_A_4 USABLE
    만일 index 가 primary key 에 정의되어 있는 columns 들과 같은 columns
    을 사용해서 만들어 졌다면 primary key 는 그 underlying index 를 사용합니다.
    이것은 index 가 unique 이건 non-unique 이건 또는 global 이건 local partioned index
    이건 관계없이 적용됩니다.
    위의 예제에서 primary key 가 non-unique index 위에 생성되었다는 것을
    주의해 보시기 바랍니다. 이렇게 되는 이유는 index 안의 값들이 사실
    모두 unique 하기 때문입니다. 그렇지 않을 경우 다음 에러가 발생하게 됩니다.
    "ORA-02437: cannot enable (STEELY.PK_TEST_B) - primary key violated."
    2개의 indexes 가 같은 순서의 같은 columns 을 사용해서 만들어 질 수는 없습니다.
    위의 예제에서 TEST_B 테이블에 두번째 index (IX_TEST_B2) 를 만들려고
    했을때 다음에러가 발생하는것을 확인할 수 있었습니다.
    "ORA-01408: such column list already indexed."
    하지만 columns 들의 순서를 바꾼다면 같은 columns 들을 사용하더라도
    추가적으로 indexes 를 생성할 수 있습니다.
    index (IX_TEST_A) 와 primary key (PK_TEST_A) 에 정의된 column 순서는
    반대로 되어 있습니다. 그러나 primary key 는 IX_TEST_A 를 underlying index
    로 사용하고 있습니다.
    테이블에서 primary key constraint 가 drop 되었을때
    만일 index 가 UNIQUE index 로 생성되었다면 대응하는 index 또한 drop 됩니다.
    이 현상은 LOCAL 또는 GLOBAL partitioned indexes 모두에 적용됩니다.
    partitioning 을 최대한 활용하기 위해서는 partitioned tables/indexes
    를 생성할 때에 STORAGE clause 를 반드시 사용해야 합니다.
    Reference Documents
    <Note:74224.1>

    First, thanks for posting the code that lets us reproduce your test. That is essential for issues like this.
    Because the primary key is global you will not be able to use
    INCLUDING INDEXES
    WITH VALIDATION;And you will need to add the primary key to the temp table
    ALTER TABLE DEMO_INTERVAL_DATA_LOAD_Y ADD CONSTRAINT IDX_DEMO_ROLL_Y PRIMARY KEY (ROLL_NUM);The the exchange will work. You will need to rebuild the primary key after the exchange.

  • Getting ORA-00001 while using MERGE

    hi there,
    I am loading data from one Oracle table into another, using MERGE. My target table has a primary key constraint on TRANS_DATE, SEQ_NR and FILE_NAME. I have made sure that there are no duplicate rows in the the source table with regard to the target tables's primary key.
    The problem is that I am getting ORA-00001: Primary Key Violated ...
    my code is as follows:
    declare
    begin
    merge into fact_prepaidcalls_tb TARG
    using
    select
    nvl(fact_prepcustomers_tb.subscriberid,0) SUBSCRIBERID,
    accnum ACCNUM,
    sdrdate TRANS_DATE,
    TO_NUMBER(to_char(sdrdate,'yyyymmdd')) DIMDATEID,
    return_timeid(sdrdate) DIMTIMEID,
    return_peaktimeid(to_char(PAY_SDR.SDRDATE,'hh24miss'),SDRDATE) DIMPEAKTIMEID,
    nvl(dim_calltype.dimcalltypeid,0) DIMCALLTYPEID,
    sdrduration CHARGEDURATION,
    nvl(dim_tds_term.DIMTDStermid,9999) DIMTDSTERMID,
    calling CALLING,
    called CALLED,
    cparty CPARTY,
    freetimeused FREETIMEUSED,
    creditused CREDITUSED,
    creditrebate CREDITREBATE,
    servicetax SERVICETAX,
    surcharge SURCHARGE,
    follow FOLLOW,
    nvl(dim_call_location.dimcalllocationid,0) DIMCALLLOCATIONID,
    startbalance STARTBALANCE,
    priceoption PRICEOPTION,
    nvl(dim_cos.dimcosid,0) DIMCOSID,
    nvl(debitrate1,0) DEBITRATE1,
    debitrate2,
    prepaid.pay_sdr.region REGION,
    substr(file_name, instr(file_name,'cdr')) FILE_NAME,
    seq_nr SEQ_NR,
    SYSDATE LOADDATE,
    ORIGINNODE
    from prepaid.pay_sdr, dim_call_location, dim_calltype, dim_cos, dim_tds_term, fact_prepcustomers_tb
    where sdrdate >= to_date('10-Feb-2008 000000','dd-mon-rrrr hh24miss') and
    sdrdate <= to_date('10-Feb-2008 235959','dd-mon-rrrr hh24miss') and
    fact_prepcustomers_tb.msisdn = prepaid.pay_sdr.accnum and
    dim_calltype.calltypeid = prepaid.pay_sdr.type and
    dim_call_location.cellid = prepaid.pay_sdr.region and
    dim_cos.cosid = prepaid.pay_sdr.cos and
    dim_tds_term.termid = prepaid.pay_sdr.term
    ) SOUR
    on
    TARG.TRANS_DATE = SOUR.TRANS_DATE      and          
    TARG.SEQ_NR = SOUR.SEQ_NR      and          
    TARG.FILE_NAME = SOUR.FILE_NAME
    when not matched then
    --load fact data
    insert
    ( SUBSCRIBERID,
    ACCNUM,
    TRANS_DATE,
    DIMDATEID,
    DIMTIMEID,
    DIMPEAKTIMEID,
    DIMCALLTYPEID,
    CHARGEDURATION,
    DIMTDSTERMID,
    CALLING,
    CALLED,
    CPARTY,
    FREETIMEUSED,
    CREDITUSED,
    CREDITREBATE,
    SERVICETAX,
    SURCHARGE,
    FOLLOW,
    DIMCALLLOCATIONID,
    STARTBALANCE,
    PRICEOPTION,
    DIMCOSID,
    DEBITRATE1,
    DEBITRATE2,
    REGION,
    FILE_NAME,
    SEQ_NR,
    LOADDATE,
    CALLCHARGE,
    originnode)
    values
    ( SOUR.subscriberid,
    SOUR.ACCNUM,
    SOUR.TRANS_DATE,
    SOUR.DIMDATEID,
    SOUR.DIMTIMEID,
    SOUR.DIMPEAKTIMEID,
    SOUR.DIMCALLTYPEID,
    SOUR.CHARGEDURATION,
    SOUR.DIMTDSTERMID,
    SOUR.CALLING,
    SOUR.CALLED,
    SOUR.CPARTY,
    SOUR.FREETIMEUSED,
    SOUR.CREDITUSED,
    SOUR.CREDITREBATE,
    SOUR.SERVICETAX,
    SOUR.SURCHARGE,
    SOUR.FOLLOW,
    SOUR.DIMCALLLOCATIONID,
    SOUR.STARTBALANCE,
    SOUR.PRICEOPTION,
    SOUR.DIMCOSID,
    SOUR.DEBITRATE1,
    SOUR.DEBITRATE2,
    SOUR.REGION,
    SOUR.FILE_NAME,
    SOUR.SEQ_NR,
    SOUR.LOADDATE,
    SOUR.DEBITRATE1,
    SOUR.originnode);
    commit;
    end;

    Hi,
    you're missing WHEN MATCHED THEN <update_clause>
    {noformat}
    MERGE <hint> INTO <table_name>
    USING <table_view_or_query>
    ON (<condition>)
    WHEN MATCHED THEN <update_clause>
    DELETE <where_clause>
    WHEN NOT MATCHED THEN <insert_clause>
    [LOG ERRORS <log_errors_clause> <reject limit <integer | unlimited>];
    {noformat}
    Edited by: bobbydj on Sep 18, 2008 4:53 PM
    or you can try and add the primary key in the on condition

  • Not closing ResultSet, but not getting ORA-01000

    I have an application that is generating the familiar ORA-01000 error.
    Whilst investigating the problem, I wrote a small test program. In the test program I tried to get the ORA-01000, but I don't get it (has anyone ever complained about not getting ORA-01000 before?!)
    connection = DriverManager.getConnection("<connection string>");
    String sql = "SELECT c1 FROM pdtab2 WHERE Id>=? AND Id<=?";
    PreparedStatement ps = connection.prepareStatement(sql);
    for (int i = 1; i <= 30000; ++i)
        ps.setInt(1, i-1);
        ps.setInt(2, i+1);
        if (i % 100 == 0)
            System.out.println("i=" +i);
            System.out.println("getCurrentOpenCursors(connection)="
                               +getCurrentOpenCursors(connection));
        try
            rs = ps.executeQuery();
            while (rs.next())
                result = rs.getInt(1);
        catch (SQLException e2)
            e2.printStackTrace();
        finally
            // Do nothing! Do not close the result set
    }getCurrentOpenCursors does:
    select count(*) AS COUNT from v$open_cursor where user_name like 'me'
    I have reduced OPEN_CURSORS down from 300 to 100, but getCurrentOpenCursors always returns less that what it is set to. Suggesting that OPEN_CUSRORS is not a limit, but rather a pool size?
    The result set returns more than one record, I never close the result set, yet I do not get an ORA-01000 error. I have tried auto-commit true and false on the connection. Is the prepared statement closing its previous result set on each new iteration of the loop, hence stopping me getting a problem?
    I am using Oracle version 10.2.0.1, the corresponding ojdbc14.jar, and Java 1.4.
    Thanks,
    Paul

    Here is a program that does that for you.
    To fix the program, un-comment the line 24 of the code and run again.
    C:\> type TestCursors.java
    import java.lang.* ;
    import java.util.* ;
    import java.sql.* ;
    import oracle.jdbc.* ;
    public class TestCursors
        public static void main(String[] args) throws SQLException, ClassNotFoundException
            Class.forName("oracle.jdbc.driver.OracleDriver");
            Connection connection = DriverManager.getConnection("jdbc:oracle:oci:@localhost:1521:ORCL");
            ResultSet rs ;
            PreparedStatement ps ;
            for (int i = 1; i <= 30000; ++i)
                String sql = "SELECT 20 FROM scott.emp WHERE deptno = ?";
                ps = connection.prepareStatement(sql);
                ps.setInt(1, 10);
                try
                    rs = ps.executeQuery();
                    rs.close() ;
                    //ps.close() ;
                catch (SQLException e2)
                    System.out.println("The value if i is " + i) ;
                    throw e2 ;
    C:\> javac TestCursors.java
    C:\> java TestCursors
    The value if i is 301
    Exception in thread "main" java.sql.SQLException: ORA-01000: maximum open cursors exceeded
            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
            at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:671)
            at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:597)
            at oracle.jdbc.driver.T2CPreparedStatement.executeForDescribe(T2CPreparedStatement.java:570)
            at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1030)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1123)
            at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3284)
            at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3328)
            at TestCursors.main(TestCursors.java:22)
    C:\>

Maybe you are looking for

  • How do I add an edge web font to a style sheet?

    I am a complete beginner, trying to teach myself DreamWeaver by using the getting started turorials. In tutorial 3, item number 4, I am supposed to copy the css font code from the edge web site and paste it into the sample css sheet I created in tuto

  • Why would Lightroom video capabilities/iTunes import/Netflix streaming/Photoshop all stop working at once?

    Hi forum -- Several programs all stopped working at the same time and will only work (briefly) right after I've restarted my computer including: - iTunes audio cd importing - Lightroom video importing and playback Netflix streaming (on both Safari an

  • How to create a new page in SRM5.0 and return data

    Hi,Everyone,     I want to create a new page,for example:      when user select a po item,and then we want to create a custom button at po item basic data screen,when user click the custom button,     we want to pop up a new page for our custom logic

  • Use of BOM in sales

    Dear All, Any use of BOM in sales,how we can use BOM in sales? Regards Gajjen

  • Use of CLOB in WL 5.1

    Hello, I'm always getting this exception: java.sql.SQLException: weblogic.rmi.extensions.RemoteRuntimeException: Undeclared checked exception - with nested exception: [weblogic.rmi.ServerException: A remote exception occurred while executing the meth