Constraint ignores uncommitted rows?
I have a fairly simple transaction. I turn off autocommit, insert a record, then insert another record with a constraint that an FK in the second record reference the first record (its PK).
This transaction fails with ORA-02291: integrity constraint (FOO.BAR) violated - parent key not found
The insert was performed, and the key values are correct. All I can conclude is that the constraint is not seeing the uncommitted insert.
Isolation level is 1 (TRANSACTION_READ_UNCOMMITTED)
Access class is IBM's DatastoreJDBC running over Oracle's thin JDBC client, talking to Oracle 7.3?
I find it hard to believe that this is working as designed, unless there's some way to do nested transactions that I'm not aware of?
null
no takers?
Does Oracle participate here?
Similar Messages
-
How to ignore 1st row form the file(csv) sender CC
Hi,
I have a CSV File (File sender) that I need to load with PI.I want to Ignore 1st row from the file.
For example the File contains 10 rows but PI need to read the data from 2nd row.
because in the 1st row contains header data like name, number, mobile, address, etc., I don't want to read this 1st row. I want to read only the data which starts from the 2nd row.
can you pls tell me the ignore command File Receiver CC
I am using these commands.
Record structure: item,*
item.fieldSeparator: ,
item.endSeparator : 'nl'
item.fieldNames: Name, Number, Address, Mobile
Thanks in Adv
VankadoathHi Vankadoath,
In your content conversion use the field document offset which ignores the number of lines to be ignored.
for example if you provide the value as "1" for document offset it will ignore the first line in your file.
(Under Document Offset, specify the number of lines that are to be ignored at the beginning of the document.
This enables you to skip comment lines or column names during processing.
Regards,
Naveen. -
Ignore blank rows inbetween in Xcelsius
Hi,
We are using Xcelsius 2008, we need to ignore blank rows which are there inbetween few rows.
so we have few rows data and few blank rows rhen data and blank rows.
Ignore blank rows will only ignore the rows if its in end but it doesn't if we have inbetween.
So is there any workaround for that or any alternate component i can use. I am sing list view in current design.
Thanks,
Nimesh.Re: Ignore blank rows inbetween in Xcelsius
Hi Daniel,
Thanks for your solution.
I was facing the same issue and was able to solve it using that Flag concept.
Thanks,
Seema -
Ignore 2nd row and 4th row in Excel Sheet in SSIS Package
Hi All,
I have an SSIS package that imports an Excel sheet in which i have to ignore 2nd row and 4th row.
Please help me on this issue.Hi ShyamReddy,
Based on my test, if second and fourth rows need to be skipped is based on some conditions, we can directly add where conditions in only one Excel Source with Edit Option. Otherwise, we can try to union three Excel sources to work around this issue. For
more details, please refer to the following steps:
Set the FirstRowHasColumnName property to False, so the first row stores the column names in the sheet.
Drag three Excel Sources to the Data Flow Task.
In the Excel Source, use the SQL command below to replace the former(supposing there are three columns in the Excel sheet: col1, col2 and col3):
SELECT F1 AS col1,F2 AS col2, F3 AS col3 FROM
[sheet$A2:C2]
In the Excel Source 1, please type the SQL command below:
SELECT F1 AS col1,F2 AS col2, F3 AS col3 FROM
[sheet$A4:C4]
In the Excel Source 2, please type the SQL command below (note that the ‘n’ means the number of rows in the sheet):
SELECT F1 AS col1,F2 AS col2, F3 AS col3 FROM
[sheet$A6:Cn]
Drag a Union All component to the same task, then union those three Excel Sources.
References:
SSIS Excel import skip first rows
sql command for reading a particular sheet, column
Hope this helps.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Can I Skip Uncommitted Row ?
Hi SQL Gurus,
I have a requirement in our query to skip uncommitted row.
eg :
After I insert in table A, after insert trigger will insert row into table B
before commit, when I query to Table B, how can skip the uncomitted row ?
Is there such function in Oracle ?
Thank you very much,
xtantoYour problem lies in the shape of your transaction. You have a set of inter-related DML statements which are triggered by different events in your application. It is particularly complicated because you are mixing ADF triggers with database triggers. The point about triggers is they execute at a different granularity from the rest of our transaction. Life is a lot simpler if everything is done through PL/SQL APIs. At least, that's my opinion; other opinions are available.
You may well say "I must use a trigger, because I dont want to impact the other part of the application." but all change has an impact on the system. It's better to implement change properly and do the regression testing than to implement a "quick" kluj and break something else. Remember: a BEFORE-INSERT trigger fires whenever anybody inserts a record into that table. Hiding a second insert statement in a trigger is bad practice (except in certain tightly described scenarios, and I suspect your case ain't one of them).
Anyway, the solution to your pickle will probably lie in re-arranging your transaction so that the insert into table B happens at a different point in time, or changing when or how the check query gets executed. It's difficult to suggest some specific solutions in the absence of concrete information about your business need. At the moment you're still explaining your implementation, not the business rules underlying it. The obvious solution - to query V_STOCK before any insertions into table A - runs into problems of concurrency in a multi-user system. But, then you may run into that problem anyway.
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
I have the following table structure
AccountTable
...accountID
...RegionID
...CategoryID
...subtypeID
CategoryTable
...CategoryID
...accountID
RegionTable
...RegionID
...accountID
SubtypeTable
...SubtypeID
...accountID
I want to form a query which will select all accounts belonging to a category,region & subtype(all AND).suppose if any of this table doesnt have data then the query should ignore that table and get data for the other two conditions. is there any way to do that in PL/SQL??(no procedures/functions)Hi,
My problem is a bit different. in the tables i've included the wrong attribute.
CategoryTable
categoryID
criteriaID
RegionTable
regionID
criteriaID
I want to get all the accounts belonging to particular category/region with a particular criteria ID(All AND).so i have to have a query like
select accountID from accountstable acc where
acc.regionID in (select regionID from regiontable where criteriaID = 34)
and
acc.categoryID in (select categoryID from categorytable where criteriaID = 34)
but the problem is if any one of category/region is not having record it wont get me rows for the other condition
I cameup with a solution like this
select accountID from accountstable acc where
acc.regionID in (select regionID from regiontable where criteriaID = 34)
or
(select count(regionID) from regiontable where criteriaID = 34) = 0)
and
acc.categoryID in
select categoryID from categorytable where criteriaID = 34)
or
(select count(categoryID ) from categorytable where criteriaID = 34) = 0)
This works fine as it negates the condition when no row is found. the pblm is it is taking more time
any suggestion?? -
ORA-00001 unique constraint violation updating row
Hi Folks,
Using oracle application express version 3.1.2.00.02 to update one column in a table ORA-00001: unique constaint (BI_ADS.FCV_UK) violated error is returned. This is strange as the column being updated has no constraint on it.
We have had a trace done on the database action and it is a normal UPDATE statement.
You can run this UPDATE statement directly against the database with no errors.
When using APEX the error is returned.
Some rows update OK and a few rows will not.
There are no sequences involved.
Thanks
BrianIt turns out the form is stripping the time off the date column (constraint column) and this is causing the unique contraint violation. Any one had any dealings with times not being updated with a date column from a form??
-
How to apply check constraint at a row level?
I am new to SQL. I have a schema like this. Students(student_id,student_name,club,date_of_passed_out). clubs(club_name,club_in_charge,club_inaugurated_date). The students can act as the club in charges. So it is not possible for a student to act as a club in-charge if his date_of_passed_out is less than club_inaugurated_date. I must prevent accidental inputs where the club inauguration date is greater than the date of pass out of the club in-charge. How can I achieve this. Thanks in advance.
Hi,
There should be three tables for your requirement.
Table1: Clubs ( club_name, club_inauguration_date) -- club_name is Primary Key
Table2: Students(student_id,student_name,club_name,date_of_passed_out) -- student_id primary key, club_name - Foreign Key
Table3: club_inchrg_detail ( club_name,club_incharge); -- club_incharge is - students(student_id)
SQL> create or replace trigger club_inchrg_trig
2 after insert or update on clubs
3 for each row
4 declare
5 l_passed_out date;
6 begin
7
8 select date_of_passed_out
9 into l_passed_out
10 from students
11 where student_id = :new.club_in_charge;
12
13 if inserting or updating then
14 if :new.club_inaugurated_date <= l_passed_out then
15 raise_application_error(-20100,' Student is not eligible for club incharge ');
16 end if;
17 end if;
18 end;
19 /
Trigger created.
As I already mentioned, you should have three tables for this requirement, and also I didnt handle the exceptions. This code is just for demonstration purpose only. -
I have a csv file, which has empty lines at the end.
My controlfile has a default sequence, due to which it is uploading all the empty lines at the end.
How can i tell sql*loader to ignore these lines ?
load data append into table Test_Data_staging
fields terminated by "," optionally enclosed by '"' trailing nullcols
SERIAL_NUMBER SEQUENCE(COUNT,1),
TEST_DATA_VERSION,
ENVIRONMENT,
TEST_DATA_OWNER
)Hi,
you can add a when clause (WHEN firstcolumn != BLANKS), here is an example:
LOAD DATA
INFILE 'C:\Temp\Book1.csv'
BADFILE 'C:\Temp\Book1.bad'
DISCARDFILE 'C:\Temp\Book1.dsc'
TRUNCATE
INTO TABLE "XTEST"
WHEN (col1 != BLANKS)
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' AND '"'
TRAILING NULLCOLS
(COL1,
COL2,
COL3)or if you want:
LOAD DATA APPEND INTO TABLE TEST_DATA_STAGING
WHEN (TEST_DATA_VERSION != BLANKS)
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
SERIAL_NUMBER SEQUENCE(COUNT,1),
TEST_DATA_VERSION,
ENVIRONMENT,
TEST_DATA_OWNER
{code}
Edited by: user11268895 on Aug 30, 2010 1:56 PM
Edited by: user11268895 on Aug 30, 2010 1:56 PM -
Ignore first row of data file in bulk insert
Hello
I use bulk insert to fill a table
I use code bellow
bulk insert dbo.test
from 'c:\test.txt'
with(FIRSTROW=2,FORMATFILE='c:\test.xml'
go
but data inserted to table start from 3throw.
Could you help me?I added that closing parenthesis.
format file
<?xml version="1.0"?>
<BCPFORMAT
xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharFixed" LENGTH="6"/>
<FIELD ID="2" xsi:type="CharFixed" LENGTH="2"/>
<FIELD ID="3" xsi:type="CharFixed" LENGTH="6"/>
<FIELD ID="4" xsi:type="CharFixed" LENGTH="13"/>
<FIELD ID="5" xsi:type="CharFixed" LENGTH="13"/>
<FIELD ID="6" xsi:type="CharTerm" TERMINATOR="\n"/>
</RECORD>
<ROW>
<COLUMN SOURCE="4" NAME="R3" xsi:type="SQLBIGINT"/>
<COLUMN SOURCE="5" NAME="R4" xsi:type="SQLBIGINT"/>
<COLUMN SOURCE="1" NAME="R5" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="3" NAME="R9" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="2" NAME="R8" xsi:type="SQLVARYCHAR"/>
</ROW>
</BCPFORMAT>
when I use firstrow=2 it works but do it from 3th row
bulk insert dbo.test
from 'c:\test.txt'
with(FIRSTROW=2,FORMATFILE='c:\test.xml')
go
BUT when I use firstrow=1
bulk insert dbo.test
from 'c:\test.txt'
with(FIRSTROW=1,FORMATFILE='c:\test.xml')
go
I get thia error
bulk load data conversion error(type mismatch or invalid character for the specified codepage) -
Problem deleting new uncommited rows
I am unable to create a new object, assign a sequence number and then delete that object (before ever committing to the DB).
I am using ADF toplink binding methods to create and delete the object (createInsert & delete). Once created, I associate to the parent object and assign a sequence number.
- unitOfWork.assignSequenceNumber(theNewObject)
- theNewObject.setParentObject(parentObj)
From here, I'd like to delete theNewObject - effectively, never perform the insert.
To you TopLink experts - how should I delete theNewObject or avoid having the unit of work create the insert statements?
I tried clearing the collection - parentObj.getChildObjectCollection().clear() - and expected that to deregister the object and never create an insert statement but that didn't work.
Please help!!! Thanks.
jjI'm not sure it will help, but are you able to "unRegister" the object from the UOW?
- Don -
Ignore duplicate rows - need help
i am having thousands of records in a table as below
polno polinsured polid polinsrdname polrenewalno polcommdate polexpdate polrendate polsi polpremium
POL00001 INSRD0001 id00001 ABCD 0 01-01-2000 31-12-2000 01-01-2001 1000.00 10
POL00001 INSRD0001 id00002 ABCD 0 01-01-2000 31-12-2000 01-01-2001 1000.00 10
POL00001 INSRD0001 id00003 ABCD 0 01-01-2000 31-12-2000 01-01-2001 1000.00 10
POL00001 INSRD0001 id00004 ABCD 0 01-01-2000 31-12-2000 01-01-2001 1000.00 10
POL00002 INSRD0101 id00001 WXYZ 0 01-01-2000 31-12-2000 01-01-2001 1000.00 10
POL00002 INSRD0101 id00002 WXYZ 0 01-01-2000 31-12-2000 01-01-2001 1000.00 10
POL00002 INSRD0101 id00003 WXYZ 0 01-01-2000 31-12-2000 01-01-2001 1000.00 10
POL00002 INSRD0101 id00004 WXYZ 0 01-01-2000 31-12-2000 01-01-2001 1000.00 10
now i want to list only those records where records is having max as polid for each policyPOL00001 INSRD0001 id00001 ABCD 0 01-01-2000
31-12-2000 01-01-2001 1000.00 10
POL00001 INSRD0001 id00002 ABCD 0 01-01-2000
31-12-2000 01-01-2001 1000.00 10
POL00001 INSRD0001 id00003 ABCD 0 01-01-2000
31-12-2000 01-01-2001 1000.00 10POL00001 INSRD0001 id00004 ABCD 0 01-01-2000
31-12-2000 01-01-2001 1000.00 10
POL00002 INSRD0101 id00001 WXYZ 0 01-01-2000
31-12-2000 01-01-2001 1000.00 10
POL00002 INSRD0101 id00002 WXYZ 0 01-01-2000
31-12-2000 01-01-2001 1000.00 10
POL00002 INSRD0101 id00003 WXYZ 0 01-01-2000
31-12-2000 01-01-2001 1000.00 10POL00002 INSRD0101 id00004 WXYZ 0 01-01-2000
31-12-2000 01-01-2001 1000.00 10
>
Can you say these two records are identical?
I don't think so. Just look at the highlighted once.
Regards
Satyaki De. -
Exp/imp full or transportable tablespaces?
Hi Experts,
DB version: 10.2.0.4 64 bit enterprise edition
OS version: Windows 2003 R2 64 bit
here database moving from 10.2.0.4 enterprise edition to standard edition.
i have went through metalink, i found
*10G : Step by Step Procedure to Migrate from Enterprise Edition to Standard Edition [ID 465189.1]*
*Converting An Enterprise Edition Database To Standard Edition [ID 139642.1]*
so i have taken export of full database before that i have create a DBLINK & TABLES ,
i have impoted into standard edition but i have missed those DBLINKS and grants will imported?
Thanks.hi guru,
my expectation is the entire database should pilot to new server with standard edition. i have read articles from metalink, as per traditional export/import is a better.
By that process i tested,
1) production database:-
a)created some tables, one database link
b) exp system/*** full=y file=exp.dmp log=exp.log
2)another side, i have created a dummy database using DBCA, and created some tablespaces as exist in export side.
a) imp system/*** full=y file=exp.dmp log=imp.log
so after successful import, i have checked objects but i missed the DBLINK from production.
1)my question is any other parameters should be process within import? to perform full export/import
2)all the schemas will be imported or manully need to create?
3)grants will be imported?
4) what about constraints.
ignore=y rows=n.i want to export rows also(entire database) -
My final data table contains a two key columns unique key constraint. I insert data into this table from a daily capture table (which also contains the two columns that make up the key in the final data table but are not constrained
(not unique) in the daily capture table). I don't want to insert rows from daily capture which already exists in final data table (based on the two key columns). Currently, what I do is to select * into a #temp table from the join
of daily capture and final data tables on these two key columns. Then I delete the rows in the daily capture table which match the #temp table. Then I insert the remaining rows from daily capture into the final data table.
Would it be possible to simplify this process by using an Instead Of trigger in the final table and just insert directly from the daily capture table? How would this look?
What is the best practice for inserting unique (new) rows and ignoring duplicate rows (rows that already exist in both the daily capture and final data tables) in my particular operation?
Rich PPlease follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
>> My final data table contains a two key columns unique key constraint. [unh? one two-column key or two one column keys? Sure wish you posted DDL] I insert data into this table from a daily capture table (which also contains the two columns that make
up the key in the final data table but are not constrained (not unique) in the daily capture table). <<
Then the "capture table" is not a table at all! Remember the fist day of your RDBMS class? A table has to have a key. You need to fix this error. What ETL tool do you use?
>> I don't want to insert rows from daily capture which already exists in final data table (based on the two key columns). <<
MERGE statement; Google it. And do not use temp tables.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Selectively delete uncommitted VO rows
Hi,
JDev version: 11.1.1.6.0
We have create/edit pages which are called from a home page. As per business requirement, all changes are committed on home page only. So on Create/Edit, data is only saved in EO-VO.
Now we have following scenario:
1) From Home page navigate to Create page.
2) In Create page, enter master-detail data. Click ‘Save’ to navigate back to Edit Account page.
3) Click edit to navigate to Edit page.
4) In Edit page, add a detail record. Click ‘Cancel’ button.
Now since we cannot do ROLLBACK on cancel button, we are iterating through the detail VO to find/remove uncommitted rows (with STATUS_NEW).
However it is deleting all uncommitted rows including earlier rows (entered in Create page)
Expected functionality is to delete uncommitted detail rows entered in Edit page only. Earlier uncommitted rows should not deleted.
Is there any way to achieve this?
Kindly advise.Hi,
the cancel button should access the current row on the ADF iterator binding and then refresh the row with undo changes
Frank
Maybe you are looking for
-
Submit Button in APEX 3.2.1 SQL Query (updateable report)
Hi all, I am fairly new to APEX. I have an updateable report and have created a button for every row as follows: <input type="button" value="Task Complete" onclick="doSubmit('#REF_STEP_ID#');" /> I have a PL/SQL anonymous block process that calls an
-
I bought my iMac in June, Just went into disk utility and I noticed that the 1TB drive was red. I've clicked on it and it says that "This drive has a harware problem that can't be repaired. Back up as much of the data as possible and replace the disk
-
How I reset my iPad with a forgotten password
Frgot my password and don't know what to do
-
Well i go to right click a new link to open in a new tab and it don't let me right click it does nothing... it doesn't bring me the drop down... == This happened == Every time Firefox opened
-
Is it possible to merge tracks that are supposed to be one CD but appear in my library as individual tracks?