To overcome the error of table constraint

Hi guys,.

I have the tables below

T1

DAT_COLIDAMOUNT
11 OCTOBER 05130
12 OCTOBER 05120
16 NOVEMBER 05120

Periods

START_DATEEND_DATEIDFLAG
30-SEP-0513 OCTOBER 051N
12 OCTOBER 0514 NOVEMBER 051THERE
15 NOVEMBER 0515 DECEMBER 051N

I need to compare dates i.e. table T1 dat_col between start and closing date of the periods with indicator N table and query again with it, something like that

Select * from T1 a, b of periods

where a.id = b.id

and a.DAT_COL between b.START_DATE and b.end_Date

and b.flag = order of "n" of dat_col;

DAT_COLIDAMOUNTSTART_DATEEND_DATEID_1FLAG
11 OCTOBER 0513030-SEP-0513 OCTOBER 051N
12 OCTOBER 0512030-SEP-0513 OCTOBER 051N
16 NOVEMBER 0512015 NOVEMBER 0515 DECEMBER 051N

Select * from T1 a, b of periods

where a.id = b.id

and a.DAT_COL between b.START_DATE and b.end_Date

and b.flag = 'Y' order of dat_col.

DAT_COLIDAMOUNTSTART_DATEEND_DATEID_1FLAG
12 OCTOBER 0512012 OCTOBER 0514 NOVEMBER 051THERE

I try insert the output above translated by master table with primary key column on dat_col and id, since the result of the query above in duplicate which will result in a violation of primary key. Is there a way to somehow without changing the primary key

ID of the dat_col amount

Scripts:

CREATE TABLE 'T1 '.

(DATE OF THE 'DAT_COL',

The "ID" NUMBER

'AMOUNT' NUMBER (10.0)

);

CREATE TABLE 'PERIODS '.

("START_DATE" DATE,

"END_DATE" DATE,

The "ID" NUMBER

'FLAG' CHAR (1 BYTE)

);

Insert into T1 (DAT_COL, ID, AMOUNT) values (to_date('11-OCT-05','DD-MON-RR'), 1, 30);

Insert into T1 (DAT_COL, ID, AMOUNT) values (to_date('12-OCT-05','DD-MON-RR'), 1, 20);

Insert into T1 (DAT_COL, ID, AMOUNT) values (to_date('16-NOV-05','DD-MON-RR'), 1, 20);

Insert into PERIODS (start_date, end_date, ID, FLAG) values (to_date('30-SEP-05','DD-MON-RR'),to_date('13-OCT-05','DD-MON-RR'),1,'N');

Insert into PERIODS (start_date, end_date, ID, FLAG) values (to_date('12-OCT-05','DD-MON-RR'),to_date('14-NOV-05','DD-MON-RR'),1,'Y');

Insert into PERIODS (start_date, end_date, ID, FLAG) values (to_date('15-NOV-05','DD-MON-RR'),to_date('15-DEC-05','DD-MON-RR'),1,'N');

If you wait several rows with the same value of date_col in this table date_col is not to be used as your primary key.

Either change what you want to store in the table or change the primary key.

Tags: Database

Similar Questions

  • FFT waveform (file converted from Matt file lvm) - how to overcome the error dt < = 0?

    Hello

    I use a lvm file after conversion of Matt file. I wanted to get the fft spectrum. I get this error message this dt waveform<>

    How he overcome?

    I have attached the matte file and the vi that I used.

    Best regards

    FESMI

    The Forum is a bit special files that can be attached. Creating a zip file often works. Sometimes, you can change the .txt extension. If you change the extension, please indicate in your message which was the extension of the moose.

    It seems that data in the file has a time column and a column of amplitude. The LabVIEW waveform data type is a cluster of a table of amplitudes (Y), sampling interval (dt), from the time (t0) and optional attributes. That's what the power spectrum VI requires as input. The t0 values is not used if the default is fine. the value of dt can be calculated by the difference of the two adjacent values in the time column. Given that the first value is equal to zero, the second value is equal to dt.  Use the primitive to build a waveform of the palette of waveform.  Expand it to view the dt element.

    In the VI attached all lines is an indicator that contains your saved default file data. Graph XY plots that data.  After subtracting the way to get rid of a continuous component, the data is converted to a waveform. The power spectrum is calculated and displayed using the same VI as in your program. It also uses extract several Information.vi tone for the frequency and amplitude of the main peaks in the data.

    Interestingly, the lower frequency of the spectrum a harmonic of 60 Hz while the tops are almost sharp space 4 kHz ~ 100 Hz apart.  The broad peak near 2.1 kHz does not seem to have noticeable components to 60 or 100 Hz.

    How to avoid the Type of dynamic data (DDT)? Stop using screw Express! For reasons known only to EITHER screw Express a deliver their outputs via the DDT. Except when you open the block diagram of the express VI, there is no way of knowing what the underlying data structure on a thread of DDT.

    Lynn

  • Publication of default due to the error creating table _mungo

    Hello

    I'm trying to reflect the types of assets for the development of the Test environment. The mirror operation fails with the following error:

    [13:07:44.924 2014-03-04] [CS. DB] [ERROR] SQLException statement: CREATE TABLE XXXXXXX_C_Mungo (id Number (38) PRIMARY KEY NOT NULL, cs_ownerid Number (38) NOT NULL, NULL Number (38), urlvalue NULL varchar (128), stringvalue NULL varchar (2000), intvalue NUMBER (10) NULL, NULL NUMBER(38, 10), moneyvalue, NULL, TIMESTAMP NULL, NULL Number datevalue (38), text NULL CLOB, cs_attrid Number (38) NOT NULL assetvalue cs_assetgroupid floatvalue) cs_islegal char (1)
    Blobvalue NULL, NULL Number (38), cs_filterid NULL Number (38), cs_ordinal NUMBER (38, 10) NULL)
    java.sql.SQLSyntaxErrorException: ORA-02263: need to specify the data type for this column.

    After reviewing the request that I discovered that moneyvalue is missing from column data type. I checked the value of cc.money in gator.ini and it is set to the default NUMERIC value (20.3). I ran the query in the help tool to provide the data type for the column moneyvalue and it works very well.

    Version is 7.5 patch4

    No idea where it is a failure?

    Thank you

    Harish

    Hi Harish,

    What is your cc.numeric value in futuretense.ini on a server?

    Have you tried comparing the two systems differences *.ini files? (Easiest way to compare them is to sort the content first, and then use a diff of program like winmerge or diff.)

    Kind regards

    Stephan.

  • How overcome the error code 0 x 80070673 when you try to update Windows XP?

    my xp computer cannot be updated because of the above error code. How can I fix this problem?

    Thank you

    Hello

    big review here, maybe this could help:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-windows_update/installation-failure-error-code-0x80070673/f4f4a99e-1f5f-E011-8dfc-68b599b31bf5?msgId=483ae0c2-1c65-E011-8dfc-68b599b31bf5

    LC

  • System table or view in oracle to contain the error message

    Hello

    I created a group Materialized View Refresh. and execution in a single schema.

    Start
    DBMS_REFRESH. Refresh ('TEST');
    end.

    There is a lot of reason for the failure of execution of the Group MV refresh (such as network, change of base table problem). At the time of the failure of execution of oracle to refresh group displays an error code and error message.

    Question: -.
    Could pelase propose you any system table or view in the oracle database that can contain any error message and error number? I have to get this error without exception handling in pl/sql block.

    Thank you and best regards,
    Vinod Gupta.

    As I mentioned, there are exceptions that you can't intercept. If this work of dbms_refresh.refresh ('TEST'); results in an exception fatal server (usually an ORA-600 or an error ORA-07445 ), you can not only catch a PL/SQL block exception. All you will see (if you have a client session), is the "+ ORA-03113 end-of-file on communication channel +" error.

    Yes, you can catch a number of other exceptions. And Yes, you can write these exceptions to the errorlog table.

    Create a package error log that makes the insertion in the errorlog table. Use an autonomous transaction because it allows the error log to insert without making all existing transactions.

    Also record all PL/SQL of the error stack trace, because it helps to determine where the exception occurred. Something like dbms_utility.format_call_stack allows to get the call stack and insert this result in the error log line in the error log table.

    Then call this package since the exception handler for the refresh job.

    But before you do, you need to consider whether or not you remove this exception or not. If you do, then Oracle work process does not see this exception and think that the work has been a success. It you do not have, the process will be the exception, to realize the task failed and reported that employment for re-delivery.

    So basically, your refresh job will look something like this:

    begin
      dbms_refresh.refresh ('TEST');
    
    exception when OTHERS then
      -- the package will record the actual SQLCODE error and call stack
      errorLog.saveException( appErrorMessage => 'Refresh job for TEST failed' ); 
    
      -- we want the job processor to see the error and reschedule the job for execution
      raise;
    end;
    
  • Impossible to update sound card: I get the error message "could not create c:\cabs\d20007-003-001-decompressez operation canceled."

    Hello
    I have a gateway MT6460, Windows Vista 32-bit model. I got this update for my sound card on the site of the bridge, it has downloaded to my desktop and double clicked on it when it was all the download and it came with this error message. It is not a folder. I don't think that... It seems that it is just a single file... But ya. Any help is very appreciated! If more information is needed let me know.

    If it is an exe file, it is not a zip file - this is a simple executable that just needs to be executed.  Try right-clicking on the file, and then click Run as Administrator - this works sometimes when normal means of installation only.  Try disabling your security software before installing because that can sometimes interfere.  Try doing with no ongoing enforcement in case another program.

    The only way to determine if it applies to your system needs to communicate with the computer manufacturer's technical support Department and ask them.  I am concerned that your computer model is not listed, but it did come with a search for your computer model so I don't know - but they will be.  Maybe they can also help you with the installation (since it's their software) - I at least ask for help when you call (it can't hurt and may even help).  If the error persists, then only they can help you (if you have tried all the steps I suggested) since it is their software and they are the only ones who know how to overcome the error message.

    If you want to see file types (and that's a good thing to know), go to start / Control Panel / folder Options / View and uncheck Hide extensions for known file types.  Then you will be able to see extensions in Windows Explorer or on your desktop.

    I strongly suggest that you get your device drivers directly against the manufacturer of the computer or the manufacturer of the device and NOT Microsoft Updates.  In fact, you must disable automatic updates in Windows Update driver as follows: http://www.addictivetips.com/windows-tips/how-to-disable-automatic-driver-installation-in-windows-vista/. (I would do it now before you forget).  I've seen too many times when Microsoft Update driver is older or different from that of the manufacturer of the computer or the manufacturer of the device and causes more problems than it solves (Windows Update drivers are not as up-to-date as those from manufacturers).

    I hope this helps.

    Good luck! Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I want my procedure to return the error message in the batch file

    Hi team,

    I have a requirement from users of the company. Could you please provide your suggetsion to achieve this.

    We have a batch file that is short on time, in this batch file, I'll call you a SQL script.

    In the SQL script, I called you a procedure to run.

    Inside the procedure, I have the following statement,

    Select, insert and update commands.

    and I use ANOTHER exception to handle errors.

    My requirement is to pass the error messages for the batch file when one of the orders was not not run and send a notification e-mail to the group with the error text.

    Please provide your suggestion.

    Thank you and best regards,

    Robette.

    Could you please tell me, inside the procedure I have to remove the OTHER exception and how I can pass the value to the command file and where I add the content of the e-mail notification.

    I suggest that you write modular code instead.

    1. create a log table

    2 modify the procedure to log on to the error log table or exceptions

    3. that others suggest have the recovery/return procedure an exception in the client/batch file

    4. for an exception have the batch file to call a procedure to do the emailing if there were exceptions

    IMHO, it's a MISTAKE to try to put all these features in a single file. It is NOT scalable and makes it almost impossible to update the batch file if the requirements change in the future.

    Logging should be a separate process with a separate log table so that you can capture ALL of the information that may be necessary, now or in the future. Enter information in a table of newspaper, it is EASY for ANYONE to query to see what problems are occurring in the process.

    Emailing should be a separate process so that it can be used for your batch file current, files of future orders or even by procedures or functions in the database.

    Do not try to create a solution "a script does everything."

  • Save the error data

    Hi all

    I have main_tbl of the table. I want to extract all lines of this line to temp_tbl... If all rows have error I insert these lines in error_log table.

    What is the best way to implement the feature above?

    Use DML Error logging for example

    (1) create the error log table

    BEGIN

    DBMS_ERRLOG.create_error_log (dml_table_name-online 'dest');

    END;

    /

    (2) runt the Insert containing the LOG clause example

    INSERT INTO dest

    SELECT *.

    SOURCE

    LOG ERRORS in err$ ('INSERT') dest DISMISS LIMIT UNLIMITED;

    (3) the rows that failed during the insertion are stored in the ERR$_DEST table, and the reason for the failure.

    COLUMN ora_err_mesg$ FORMAT A70

    SELECT ora_err_number$, ora_err_mesg$

    MRO$ dest

    WHERE the ora_err_tag$ = "INSERT."

    ORA_ERR_NUMBER$ ORA_ERR_MESG$

    --------------- ---------------------------------------------------------

    1400 ORA-01400: cannot insert NULL into ('TEST'. "" DEST ". (' ' CODE ')

    1400 ORA-01400: cannot insert NULL into ('TEST'. "" DEST ". (' ' CODE ')

    ORACLE-BASE - DML Oracle 10 g Release 2 of the database connection error

  • the impdp error: ORA-02374: conversion error loading table

    Hello

    I'm trying to convert the WE8ISO8859P1 character set AL32UTF8 using expdp/impdp. for this I first convert WE8ISO8859P1 WE8MSWIN1252 in source DB to get rid of the data "lossy." I created new (target) database with character set AL32UTF8 and nls_length_semantics = "CHAR" and donated all the tablespaces as source DB with auoexend. I took a full export (expdp) source DB excluding the TABLESPACE, STATISTICS, INDEXES, CONSTRAINTS, REF_CONSTRAINT and imported using impdp to target DB. I found error below in the import log file:

    ORA-02374: error loading «SCTCVT» conversion table "" SPRADDR_CVT ".
    ORA-26093: size of the input data column (44) exceeds the maximum input size (40)
    ORA-02372: row data: CONVERT_STREET_LINE1: 0 X '20202020202020202020202020202020202020202020202020'

    I checked with a select query on the two DBs with inferior results.

    Source D:
    04:58:42 SQL > select count (*) of "SCTCVT". "" SPRADDR_CVT ";

    COUNT (*)
    --------
    74553

    target DB:
    04: 59:24 SQL > select count (*) of "SCTCVT". "" SPRADDR_CVT ";

    COUNT (*)
    --------
    74552


    Please suggest me a solution to this.


    Thank you and best regards.

    Edited by: user12045167 may 9, 2011 22:39

    I think that, if you change your column of the table length CONVERT_STREET_LINE1 this help you.

    alter table "SCTCVT"."SPRADDR_CVT" modify (CONVERT_STREET_LINE1 varchar2(50));
    
  • Error in the importation of tables with nested table types

    Hello

    I have two tables with the nested table type when I m try to import a schema to another all tables with error to give the type of identifying different

    Here is my order of import
    imp leader = tables_nested.dmp ignore = y fromuser = ABC touser = DEV_SCHEMA toid_novalidate = sup_payment_type
    I tried to import with the option TOID_NOVALIDATE, but it says
    IMP-00086: TOLD 'SUP_PAYMENT_TYPE' not found in the export file


    Here, the view of my log file.

    . . table import 'CONTRACT' 788 imported lines
    . . importation of "EQUIPMENT" 4301 imported table lines
    . . rows in table 'CONT_EQUIPMENT' import imported 4300
    IMP-00017: statement failed with error ORACLE 2304:
    "CREATE TYPE"SUP_PAYMENT_TYPE"TIMESTAMP" 2007-11 - 28:10:50:50' OID "3FF6F10."
    "CADC08A99E040A8C0010178F9"AS OBJECT ().
    "CONT_NO NUMBER".
    "EQP_NO NUMBER".
    "PMT_NO NUMBER".
    'DATE OF PLAN_PMT_DATE '.
    "S_NO NUMBER".
    "BATCH_NO NUMBER".
    'DATE OF TRAN_DT '.
    'DATE OF ACTUAL_PMT_DATE '.
    "ACTUAL_PAID_AMT_CURR NUMBER".
    "ACTUAL_PAID_AMT_KZT NUMBER".
    "PMT_CURSTYP_CD NUMBER".
    'NUMBER OF PMT_EXG_RATE);'
    IMP-00003: ORACLE error 2304
    ORA-02304: invalid literal object identifier
    IMP-00063: WARNING: jump table "DEV_SCHEMA". "" SUPPLIER_PAYMENT "as the type of the object
    'DEV_SCHEMA '. "' SUP_PAYMENT_TYPE ' could not be created or has identify different
    About to activate the constraints...

    Thank you

    Baptist

    Get the error on tahiti, I realized this must be a common problem and is described in Metaclunk.
    So in Metaclunk I get "ora-02304 imp' and came up with 1066139.6 ML.
    It describes your situation.
    So many times, it is very easy to solve your problems in a few minutes. I always wonder why people walk immediately into shock and horror and nothing to do when they hit a mistake.

    ----
    Sybrand Bakker
    Senior Oracle DBA

  • I can't open the help in my Quicken program, I receive script error messages. How to overcome this error message?

    I I have overcome script error messages when I try to use help in my Quicken program

    Hi Curits,

    ·         The question is limited to Quicken?

    ·         You have the latest updates of the program?

    Check if you have the latest updates of the program. You may need to contact Intuit for help.

    Quicken® support for Windows - help Quicken for Windows

  • Insert the CK error | CKM | Check constraint is not picked up by ODI11g

    I'm trying to hit a stage in CKM 'insert error CK' and it is always checked "run" and there is not so other condition in the code

    I've created an interface that has activated the Frother and target constraint check (no constraint check in ODI datastore)

    Now how should be my designed interface for my "insert error CK' step executed?

    Sorry, I wrote too fast on this one, I'm not sure of the Oracle RKM's check of reverse engineering constraints. It may be only PKs, FKs and constraints not null.

    CHECK in ODI constraints are called "Conditions". You can add it by expanding your data store in the left pane and right-click on the constraints:

    Kind regards

    JeromeFr

  • ORA-31693: Data Table object 'AWSTEMPUSER '. "' TEMPMANUALMAPRPT_273 ' failed to load/unload and being ignored because of the error:

    Dear all,

    OS - Windows server 2012 R2

    version - 11.2.0.1.0

    Server: production server

    ORA-31693: Data Table object 'AWSTEMPUSER '. "' TEMPMANUALMAPRPT_273 ' failed to load/unload and being ignored because of the error:

    ORA-02354: Error exporting/importing data

    ORA-00942: table or view does not exist

    When taken expdp and faced error mentioned above. but expdp completed successfully with waring as below.

    Work "AWSCOMMONMASTER". "" FULLEXPJOB26SEP15_053001 "finished with 6 errors at 09:30:54

    (1) what is the error

    (2) is there any problem in the dump because file as above of the error. If Yes, then I'll resume expdp.

    Please suggest me. Thanks in advance

    Hello

    I suspect that what has happened, is that demand has dropped a temporary table to during the time that you run the export - consider this series of events

    (1) temp table created by application

    (2) start expdp work - including this table

    (3) the extracted table metadata

    (4) the application deletes the table

    (5) expdp is trying to retrieve data from the table - and gets the above error.

    Just to confirm with the enforcement team that the table is just a temporary thing - it certainly seems it name.

    See you soon,.

    Rich

  • Solution for the mutation of table of error when using triggers

    Hello

    Could you please give the solution for the error table mutation during the use of triggers. I'll give you the simple scenario here,

    I created a trigger on the employees table, whenever all DML operations takes place in the employees table, it must run the trigger body. I intentionally used also of the employees in the body of the trigger table. Please give me the solution.

    Triggering factor:

    create or replace trigger test_trigger

    before you insert or update or delete employees

    for each line

    declare

    an employees.first_name%type;

    Start

    Select first_name from people where job_id = "AD_PRES";

    end;

    DML statement:

    Update employees set salary = 20000 where job_id = "AD_PRES" (I run this query)

    Error message:

    ORA-04091: table HR. Is the transfer of EMPLOYEES, the function of triggering/can not see

    ORA-06512: at "HR. TEST_TRIGGER', line 4

    ORA-04088: error during execution of trigger ' HR. TEST_TRIGGER'

    Can anyone tell, in what other scenarios, we get this error or recursive table mutation?

    Thanks in advance

    Hello

    When you create a trigger on a table, you cannot edit/query this table the trigger is not completed.

    You can use

    (1) transaction of Pragma autonomous

    (2) instead of row-level trigger, you have statement-level trigger

    (3) to 11 g, try with COMPOSITE trigger

    Try below to avoid it (a solution):

    create or replace trigger test_trigger

    before you insert or update or delete employees

    for each line

    declare

    PRAGMA AUTONOMOUS_TRANSACTION;

    an employees.first_name%type;

    Start

    Select first_name from people where job_id = "AD_PRES";

    COMMIT;

    end;

  • Form triggers the error when the table trigger fires.

    Hi all!

    Recently, I had to add a modification_date column to a table accessed in several forms.

    In an effort to not modify these several forms, my initial effort was to add an insert/update trigger.

    As you can guess, the trigger works as expected, but an error is triggered by each form to the effect that another user has made changes that require a re - interview.

    Can anyone suggest an alternative method (short discount - I don't still want to send forms if possible)?

    If I am forced to change the forms, SYNCHRONIZE will do?

    Alternatively, do I change before insertion and prior update on each form?

    Thank you!

    Mike

    MikeShannon wrote:
    .. .my initial effort was to add a trigger for insert/updated to date...

    ... As you can guess, the trigger works as expected, but an error is triggered by each form to the effect that another user has made changes that require a re - interview...

    What trigger you added to your table? (Before insert/update; After insert/update?)

    So, the "record error updated by another user" occurs after a change has been introduced and the user attempts to edit the record again - is that correct?  From your description, it's when I 'think' you get the error.  Could clarify you?

    You could just refresh your block after validation, but this would require to change your forms - which is what you were trying to avoid.  I don't think you'll be able to avoid modifing your forms.

    Craig...

Maybe you are looking for

  • menu bookmarks invisible on the personal bar

    My drop down bookmarks menu has disappeard in the bookmarks toolbar. When I try to customize the toolbar, the icon is visible on the toolbar. However, when I press "Done" it disappears again. The bookmarks toolbar items visible. Does anyone have idea

  • Cannot open pages. I immediately get crash... Help!

    Have you tried shut down and restart, only checked any available updated and uses OS El Capitan 10.11.3. Please help with this strange question that I

  • How to overcome error * stop: 0X0000007b (0xf78d2524, 0xc0000034, 0x00000000, 0x00000000)

    Hello.. I'm editing O. S XP for my laptop of Lenovo ideapad Z560 after reformulating BIOS and copy the files over and before the program installation the following error will come (it has no virus in my laptop). the error is: * stop: 0X0000007b (0xf7

  • FireWire and my camcorder

    I tried the camcorder and the cable to a different PC and they work fine on my vista machine however they do not. It does not recognize. I searched the internet for days now. My mini-dv camcorder and a samsung vp-d101 my firewire bus is also the texa

  • Stuttering Audio Windows 7 problem

    ^.^ I bought a new computer in October 2009 with a Win 7 64 bitBONES, a Realtek audio system on the motherboard, and I added aNVIDIA card top of range for gameplay purposes. I'm having the same problem of audio stuttering than many othersmeet people.