Tables with Circular Foreign Constraints
Can you load data into the two tables (they both have the a foreign key from each other) without dropping the foreign
key constraints one at a time?
If the foreign key constraints are created as DEFERRABLE, the checks are deferred until you commit. This would allow you to load both tables - and then commit at the end. Of course, if there are any constraint violations at that point, the entire transaction will rollback.
Similar Messages
-
Table with n foreign key vs n tables or n foreign key vs 1 table?
Hi,
we have a scenario with n tables containing some attributes one table for one category of attribute (es: color, role, type, etc..) of a principal entity and 1 table for the principal entity with n foreign keys vs every attribute table.
Some propose to create a unique table called attributes in which put every attribute with an attributetype for each record.
My question is: the principal entity will have n foreign keys vs the same attribute table. Is this perfomant? which is the best solution?
Thanks in advance.
v.>
we have a scenario with n tables containing some attributes one table for one category of attribute (es: color, role, type, etc..) of a principal entity and 1 table for the principal entity with n foreign keys vs every attribute table.
Some propose to create a unique table called attributes in which put every attribute with an attributetype for each record.
My question is: the principal entity will have n foreign keys vs the same attribute table. Is this perfomant? which is the best solution?
>
Ask those 'Some propose' how a foreign key to the 'same attribute table' will prevent the WRONG value from being used for a column.
1. Principal entity has a column for 'color' and a column for 'role'.
2. There are FKs on the 'color' column and the 'role' column that both point to the 'same attribute table'
3. Legal values for 'color' are: 1, 2, 3
4. Legal values for 'role' are: 10, 20, 30
What prevents someone from updating the 'color' column to a value of 20?
Ask those 'Some propose' how your one attribute table will store attributes that are of different datatypes.
1. 'color' uses numbers: 1, 2, 3
2. 'type' uses strings: 'type1', 'type2', 'type3'
3. 'holiday' uses dates: 12/25/2013, 01/01/2014
How do your 'Some propse' plan to store ALL of those values in one column? They are likely to say they will use VARCHAR2.
Ok - so how do you keep someone from updating 'holiday' to a value of 'type2' or a value of '3'?
You can't easily validate the data to begin with and you can't easily prevent 'dirty' data from getting into the system.
You also can't easily explain to ANYONE, for example new developers, how to properly use and maintain the table.
I haven't heard you mention even ONE potential benefit to doing things the way that 'Some propose'. So - DON'T DO THAT! -
Expdp table with grants indexes constraints etc
hi
i need to export table/sometime table partitions including grants, constraints, indexes
this is what im using..
expdp parfile=par.exp directory=expdir dumpfile=exp1.dmp tables=hr.employee
parfile.exp is:
userid="/ as sysdba"
JOB_NAME=dbajob
do i need to include more options?
thanks in advanceHi. As i know the indexes and the constraints need to be created with a different name.
Try DBMS_METADATA.get_ddl to export your constraints and indexes. -
Drop parent table with disabled child constraints?
I have a table I would like to drop and recreate. I do not want to have to recreate all the foreign key constraints again. Can I disable the foreign key constraints, drop the table and then recreate the table and enable the foreign key constraints?
Thanks,
John E.No.
The Triggers,Indexes,Constraints etc, assocated with a table are bound to the table they are defined for.
They owe their existance to the existance of the table.
If the table goes, so do the constraints.
If you have Oracle9i, can use DBMS_METADATA to generate the DDL script of the table before dropping it. -
Script will create database, 3 database objects and publish.
The error is due to the generation script to create the conflict tables that is not stripping out default constraints that reference a UDF.
As you can see below, the failure is on the generation script for the conflict table.
The conflict table should be a bucket table that shouldn’t enforce data integrity.
See how the default constraints for the columns someint and somestring were stripped out of the generation logic however the default constraint that utilizes a UDF persist and uses the same object name that was used on the production table (The
bold line) , this occurs if I explicitly name the constraint or let the system generate the name for me like in the example posted.
The only way I could see getting around this right now is to drop all default constraints in the system that uses a UDF, publish then add the constraints back which is vulnerable to invalid data and a lot of moving
steps. This all worked with SQL 2000, 2005, 2008, 2008r2, it’s stopped working in SQL 2012 and continues to not work in SQL 2014.
Error messages:
Message: There is already an object named 'DF__repTable__id__117F9D94' in the database.
Could not create constraint. See previous errors.
Command Text: CREATE TABLE [dbo].[MSmerge_conflict_MergeRepFailurePublication_repTable](
[id] [varchar](8) NULL CONSTRAINT [DF__repTable__id__117F9D94] DEFAULT ([dbo].[repUDF]()),
[somedata] [varchar](64) NULL,
[rowguid] [uniqueidentifier] ROWGUIDCOL NULL,
[someint] [int] NULL,
[somestring] [varchar](64) NULL
Parameters:
Stack: at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)
at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)
at Microsoft.SqlServer.Replication.Snapshot.YukonMergeConflictTableScriptingManager.ApplyBaseConflictTableScriptToPublisherIfNeeded(String strConflictScriptPath)
at Microsoft.SqlServer.Replication.Snapshot.BaseMergeConflictTableScriptingManager.DoConflictTableScriptingTransaction(SqlConnection connection)
at Microsoft.SqlServer.Replication.RetryableSqlServerTransactionManager.ExecuteTransaction(Boolean bLeaveTransactionOpen)
at Microsoft.SqlServer.Replication.Snapshot.BaseMergeConflictTableScriptingManager.DoConflictTableScripting()
at Microsoft.SqlServer.Replication.Snapshot.MergeSmoScriptingManager.GenerateTableArticleCftScript(Scripter scripter, BaseArticleWrapper articleWrapper, Table smoTable)
at Microsoft.SqlServer.Replication.Snapshot.MergeSmoScriptingManager.GenerateTableArticleScripts(ArticleScriptingBundle articleScriptingBundle)
at Microsoft.SqlServer.Replication.Snapshot.MergeSmoScriptingManager.GenerateArticleScripts(ArticleScriptingBundle articleScriptingBundle)
at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.GenerateObjectScripts(ArticleScriptingBundle articleScriptingBundle)
at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.DoScripting()
at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.DoScripting()
at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoScripting()
at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: MSSQLServer, Error number: 2714)
Get help: http://help/2714
Server COL-PCANINOW540\SQL2012, Level 16, State 0, Procedure , Line 1
Could not create constraint. See previous errors. (Source: MSSQLServer, Error number: 1750)
Get help: http://help/1750
Server COL-PCANINOW540\SQL2012, Level 16, State 0, Procedure , Line 1
Could not create constraint. See previous errors. (Source: MSSQLServer, Error number: 1750)
Get help: http://help/1750
Pauly C
USE [master]
GO
CREATE DATABASE [MergeRepFailure]
ALTER DATABASE [MergeRepFailure] SET COMPATIBILITY_LEVEL = 110
GO
USE [MergeRepFailure]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create view
[dbo].[repView] as select right(newid(),8) as id
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[repUDF]()
RETURNS varchar(8)
BEGIN
declare @val varchar(8)
select top 1 @val = id from [repView]
return @val
END
GO
create table repTable
id varchar(8) default([dbo].[repUDF]()),
somedata varchar(64) null,
rowguid uniqueidentifier ROWGUIDCOL default(newid()),
someint int default(1),
somestring varchar(64) default('somestringvalue')
GO
insert into reptable (somedata) values ('whatever1')
insert into reptable (somedata) values ('whatever2')
go
/*test to make sure function is working*/
select * from reptable
GO
/*Publish database*/
use [MergeRepFailure]
exec sp_replicationdboption @dbname = N'MergeRepFailure', @optname = N'merge publish', @value = N'true'
GO
declare @Descrip nvarchar(128)
select @Descrip = 'Merge publication of database ''MergeRepFailure'' from Publisher ''' + @@servername +'''.'
print @Descrip
-- Adding the merge publication
use [MergeRepFailure]
exec sp_addmergepublication @publication = N'MergeRepFailurePublication', @description = N'@Descrip',
@sync_mode = N'native', @retention = 14, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'true',
@enabled_for_internet = N'false', @snapshot_in_defaultfolder = N'true', @compress_snapshot = N'false', @ftp_port = 21,
@ftp_subdirectory = N'ftp', @ftp_login = N'anonymous', @allow_subscription_copy = N'false', @add_to_active_directory = N'false',
@dynamic_filters = N'false', @conflict_retention = 14, @keep_partition_changes = N'false', @allow_synctoalternate = N'false',
@max_concurrent_merge = 0, @max_concurrent_dynamic_snapshots = 0, @use_partition_groups = null, @publication_compatibility_level = N'100RTM',
@replicate_ddl = 1, @allow_subscriber_initiated_snapshot = N'false', @allow_web_synchronization = N'false', @allow_partition_realignment = N'true',
@retention_period_unit = N'days', @conflict_logging = N'both', @automatic_reinitialization_policy = 0
GO
exec sp_addpublication_snapshot @publication = N'MergeRepFailurePublication', @frequency_type = 4, @frequency_interval = 14, @frequency_relative_interval = 1,
@frequency_recurrence_factor = 0, @frequency_subday = 1, @frequency_subday_interval = 5, @active_start_time_of_day = 500, @active_end_time_of_day = 235959,
@active_start_date = 0, @active_end_date = 0, @job_login = null, @job_password = null, @publisher_security_mode = 1
use [MergeRepFailure]
exec sp_addmergearticle @publication = N'MergeRepFailurePublication', @article = N'repTable', @source_owner = N'dbo', @source_object = N'repTable', @type = N'table',
@description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x000000010C034FD1, @identityrangemanagementoption = N'manual',
@destination_owner = N'dbo', @force_reinit_subscription = 1, @column_tracking = N'false', @subset_filterclause = null, @vertical_partition = N'false',
@verify_resolver_signature = 1, @allow_interactive_resolver = N'false', @fast_multicol_updateproc = N'true', @check_permissions = 0, @subscriber_upload_options = 0,
@delete_tracking = N'true', @compensate_for_errors = N'false', @stream_blob_columns = N'false', @partition_options = 0
GO
use [MergeRepFailure]
exec sp_addmergearticle @publication = N'MergeRepFailurePublication', @article = N'repView', @source_owner = N'dbo', @source_object = N'repView',
@type = N'view schema only', @description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x0000000008000001,
@destination_owner = N'dbo', @destination_object = N'repView', @force_reinit_subscription = 1
GO
use [MergeRepFailure]
exec sp_addmergearticle @publication = N'MergeRepFailurePublication', @article = N'repUDF', @source_owner = N'dbo', @source_object = N'repUDF',
@type = N'func schema only', @description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x0000000008000001,
@destination_owner = N'dbo', @destination_object = N'repUDF', @force_reinit_subscription = 1
GOMore information, after running a profile trace the following 2 statements, the column with the default on a UDF returns a row while the other default does not. This might be the cause of this bug. Is the same logic to generate the object on
the subscriber used to generate the conflict table?
exec sp_executesql N'
select so.name, schema_name(so.schema_id)
from sys.sql_dependencies d
inner join sys.objects so
on d.referenced_major_id = so.object_id
where so.type in (''FN'', ''FS'', ''FT'', ''TF'', ''IF'')
and d.class in (0,1)
and d.referenced_major_id <> object_id(@base_table, ''U'')
and d.object_id = object_id(@constraint, ''D'')',N'@base_table nvarchar(517),@constraint nvarchar(517)',@base_table=N'[dbo].[repTable]',@constraint=N'[dbo].[DF__repTable__id__117F9D94]'
exec sp_executesql N'
select so.name, schema_name(so.schema_id)
from sys.sql_dependencies d
inner join sys.objects so
on d.referenced_major_id = so.object_id
where so.type in (''FN'', ''FS'', ''FT'', ''TF'', ''IF'')
and d.class in (0,1)
and d.referenced_major_id <> object_id(@base_table, ''U'')
and d.object_id = object_id(@constraint, ''D'')',N'@base_table nvarchar(517),@constraint nvarchar(517)',@base_table=N'[dbo].[repTable]',@constraint=N'[dbo].[DF__repTable__somein__1367E606]'
Pauly C -
Problem CREATE TABLE with PRIMARY KEY Still in Trouble ! Please Help!
Hi there !
I use the orcle 8i, and i don't know why i can't create table with any primary key EXample:
SQL> CREATE TABLE O_caisses
2 (No_caisse NUMBER(3) constraint caisses_pk PRIMARY KEY,
3 NB_BILLETS NUMBER(5)
4 )
5 /
CREATE TABLE O_caisses
ERROR at line 1:
ORA-18008: cannot find OUTLN schema
***********some Debuger show me this way: *********************
Well there r certain point u got to notice when creating a table with constraints.
1) U can create table with COLUMN level constraint.
2) U can create table with TABLE level constraint.
3) In COLUMN level constraint u can't give a constraint a name
but only mention the type of constraint.
4) In TABLE level constraint u can give a name to constraint.
Following are the examples of both
--COLUMN LEVEL
CREATE TABLE O_caisses
(No_caisse NUMBER(3) PRIMARY KEY,
NB_BILLETS NUMBER(5));
--TABLE LEVEL
CREATE TABLE O_caisses
(No_caisse NUMBER(3),
NB_BILLETS NUMBER(5),
constraint pk_caisse primary key (No_caisse));
********************And this is another one:*****************
SQL>grant create any outline to username;
BUT the problem is still present, i don't know what to do now !
Please could some body help me !
Thanks alot!
Luong.The clue is in the error message: the OUTLN schema is missing.
This is something Oracle 8i introduced to help manage the CBO (or soemthing equally geeky and internal). For some reason your database no longer has this user. It ought to be created automatically during installation (or upgrade) but catproct may not have completed probably or some over zealous admin type has dropped it.
Solution is to re-install (or re-upgrade) as you cannot create this user on their own. Alas.
HTH, APC -
Large insert op into table with indexes
Hi,
Oracle 8.1.7.0. Empty table (after truncate) with two indexes. Need to insert about 40 billions records. What is better way to complete this task:
1. Drop indexes, insert data then build indexes.
2. Simply insert data into table.
Thanks.The only way to find out is to test... For example, I did a test on my single-cpu box with Oracle 9i. My test was to load all the rows from DBA_SOURCE (only 650k rows). I found that a single insert statement with bitmap indexes online ran faster than the total elapsed time for taking the indexes offline, inserting, and bringing the indexes back up...
With 40-billion rows, I presume you're using partitioned tables and enabling parrallel DML. Thus, your test will be much different than mine...
In past ETL projects I worked on, I found little difference in timing. I decided that I didn't want to drop indexes (it was ver8i) so I loaded the empty tables with indexes (and constraints) enabled...
Stan -
Dear All
i have a a project ADF-BC / JSF - JDeveloper 11.1.2.3.0 latest, and i have EO contains PK constrain in db in 2 fields (userid & Roleid) and i implemented bundle to handle error message with jbo error code and it works fine in AM test
and i have VO contains LOV in one attribute of this unique constrain columns (Roleid), now i dropped VO in jsf page as a af:table as below with input text with list of values for roleid and auto submit = true , and i face unexpected behavior from lov attribute in case of entering repeated value ..
when i enter another repeated value , it give me error message i created in the bundle and everything ok until now
but when i tab out of input text with list of values , it go back to old value as may be validation fired in back ground , it is not a problem until now
when i try to make anything else, he still gives me error message of duplicated key
i change the value again to correct value to avoid duplication error message , i am surprised , still i get the error message and shows me the repeated value again !!
simply it still save the old repeated value however i corrected , please any one help me to know what is happening and how to solve ?
Attribute in EO :
<Attribute
Name="RoleId"
Precision="10"
ColumnName="ROLE_ID"
SQLType="VARCHAR"
Type="java.lang.String"
ColumnType="VARCHAR2"
TableName="USER_ROLES"
PrimaryKey="true">
<DesignTime>
<Attr Name="_DisplaySize" Value="10"/>
</DesignTime>
<validation:ExistsValidationBean
Name="RoleId_Rule_1"
ResId="CS.model.BC.EO.UserRolesEO.RoleId_Rule_1"
OperandType="EO"
AssocName="CS.model.BC.ASS.UsersRolesFk2ASS"/>
</Attribute>
Interface af : table
<af:table value="#{bindings.UserRoles2.collectionModel}" var="row"
rows="#{bindings.UserRoles2.rangeSize}"
emptyText="#{bindings.UserRoles2.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.UserRoles2.rangeSize}"
rowBandingInterval="0"
filterModel="#{bindings.UserRoles2Query.queryDescriptor}"
queryListener="#{bindings.UserRoles2Query.processQuery}"
filterVisible="true" varStatus="vs"
selectedRowKeys="#{bindings.UserRoles2.collectionModel.selectedRow}"
selectionListener="#{bindings.UserRoles2.collectionModel.makeCurrent}"
rowSelection="single" id="t1" columnSelection="none"
columnStretching="column:c3">
<af:column sortProperty="#{bindings.UserRoles2.hints.RoleId.name}"
filterable="true" sortable="true"
headerText="#{bindings.UserRoles2.hints.RoleId.label}"
id="c2">
<af:inputListOfValues id="roleIdId"
popupTitle="Search and Select: #{bindings.UserRoles2.hints.RoleId.label}"
value="#{row.bindings.RoleId.inputValue}"
model="#{row.bindings.RoleId.listOfValuesModel}"
required="#{bindings.UserRoles2.hints.RoleId.mandatory}"
columns="#{bindings.UserRoles2.hints.RoleId.displayWidth}"
shortDesc="#{bindings.UserRoles2.hints.RoleId.tooltip}"
autoSubmit="true" editMode="select">
<f:validator binding="#{row.bindings.RoleId.validator}"/>
</af:inputListOfValues>
</af:column>
<af:column sortProperty="#{bindings.UserRoles2.hints.RoleName.name}"
sortable="true"
headerText="#{bindings.UserRoles2.hints.RoleName.label}"
id="c3">
<af:outputFormatted value="#{row.bindings.RoleName.inputValue}"
id="of7" partialTriggers="roleIdId"/>
</af:column>
<af:column sortProperty="#{bindings.UserRoles2.hints.Active.name}"
filterable="true" sortable="true"
headerText="#{bindings.UserRoles2.hints.Active.label}"
id="c4">
<af:outputFormatted value="#{row.bindings.Active.inputValue}"
id="of8" partialTriggers="roleIdId"/>
</af:column>
</af:table>
Edited by: user8854969 on Oct 7, 2012 1:34 PM
Edited by: user8854969 on Oct 7, 2012 2:16 PMI believe there is a little confusion here. The error I am encountering has to do with a unique constraint violation and not a foreign key constraint. If I have the data:
PK FK sequence
1 5 1
2 5 2
3 5 3
with a unique constraint on (FK, sequence) and want to change it to:
PK FK sequence
1 5 1
4 5 2 --insert
2 5 3 --update on sequence
3 5 4 --update on sequence
I am currently getting a unique constraint violation because the insert is issued before the updates, and the updates alone cause problems because they are issued out of order (i.e. if I do the shifting operation without the insertion of a new record). -
The DELETE statement conflicted with the REFERENCE constraint "FK_Equipment_Assets". The conflict occurred in database "WorkOrderSystem", table "dbo.Equipment", column 'AssetCode'
ya that's true row is referenced by another table.....but i want the row to referred by another table ,I don't know how to fix it
Actually this is not a C# issue. It is a T-SQl issue.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=transactsql
The above link should be posted.
Per my understanding, first you should
delete the record from the Foreign Table and then after you have to delete the record from the Primary Key table
Hope it helps you.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Problem creating table with foreign key in SQL Workshop
Application Express version 2.2.1.00.04
Get error message "Number of referencing columns/data types must match referenced columns"
Master table SLS_SUPPLIERS has primary key SLS_ID NUMBER(8,0) and when creating table SLS_PRODUCTS with FK SLS_SLP_ID NUMBER(8,0) using the create table wizard I get the above error.
The name of the FK is SLP_SLS_FK, key column is SLP_SLS_ID, referenced table is SLS_SUPPLIERS and referenced column is SLS_ID.
Any help is much appreciated.
James Edey
I should add that if I create the table without the foreign key constraint and then create the constraint separately in SQL Workshop then it creates OK. It only fails in the create table wizard dialog.
Message was edited by:
edeyje
Obviously no-one interested in this - just thought it may be a bug in v2.2 that the development team would find useful.
James
Message was edited by:
edeyjeI replied to the other thread on this too -
there is a bug on that page when you click Next. If you define more than one fk but then navigate using the links on the process chart on the left (Constraints, Confirm, etc), the page works fine. We do have a bug on this now and I just added the notes I will need to get this fixed in 3.1 (I have already assigned it to me - must have some rogue validation that fires on next).
Sorry it took so long for this to get noticed - I am glad I checked the forum this morning -
-- Sharon -
Maintenance View for custom table with foreign key relationship
Hi Folks,
I have created a custom table with foreign key relationship with other check tables. I want to create a maintenance view / tablemaintenance generator. What all things I need to take care for the foreign keys related fields while creating the maintenance view / tablemaintenance generator.
Regards,
santoshHi,
You do not have to do anything explicitely for the foreign key relationships in the table maintainance generator.
Create the table maintainance generator via SE11 and it will take care of all teh foreign key checks by itself.
Regards,
Ankur Parab -
How to insert record in child table with foreign key
Hi,
I am using Jdeveloper 11.1.2.0. I have two master table one child table.
How to insert and update a record in child table with foreign key ?
I have created VO based on three EO(one eo is updatable other two eo are references) by using joined query.
Thanks in Advance
Edited by: 890233 on Dec 24, 2011 10:40 PM... And here is the example to insert using sequenceimpl by getting the primary key of the master record and insert master and detail together.
Re: Unable to insert a new row with a sequence generated column id
-Arun -
Loading millions of rows using SQL*loader to a table with constraints
I have a table with constraints and I need to load millions of rows in it using SQL*Loader.
What is the best way to do this, means what SQL*Loader options to use, for getting the best loading performance and how to deal with constraints?
Regards- check if your table has check constraints (like column not null)
if you trust the data in the file you have to load you can disable this constrainst and after the loader enable this constrainst.
- Check if you can modify the table and place it in nologging mode (generate less redo but ONLY is SOME Conditions)
Hope it helps
Rui Madaleno -
Issue in adding not null constraint on 250 G table with 50 million rows.
Guys,
I need to add not null constraint on 2 column of a table with 50 million rows and ~250 GB in size, These 2 columns are newly added and I have also update the value for each of these columns to not null for each row.
After that I am adding not null constraint on these 2 columns this is taking 1 hour to complete, Is there any way to speed up this, I don't want to use ENABLE NOVALIDATE option or rather I can't use that option.user445775 wrote:
Guys,
I need to add not null constraint on 2 column of a table with 50 million rows and ~250 GB in size, These 2 columns are newly added and I have also update the value for each of these columns to not null for each row.
After that I am adding not null constraint on these 2 columns this is taking 1 hour to complete, Is there any way to speed up this, I don't want to use ENABLE NOVALIDATE option or rather I can't use that option.And what's wrong with it taking an hour? Presumably, this is a one time operation, and it doesn't really interfere with anything else. -
Create table with constraint and index
If I create a table with constraint key; after that I create an unique index key, I got an error. Please see below.
Does it mean when I create a table with constraint the unique index are automatically created and I could not create
index key as I did as below?
create table test_const(ename varchar2(50) not null,
key_num number not null,
descr varchar2(100),
constraint constraint_test_const unique (ename, key_num));
create unique index test_const_idx on test_const
"ENAME","KEY_NUM"
tablespace tmp_data;
Error report:
SQL Error: ORA-01408: such column list already indexed
*01408. 00000 - "such column list already indexed"*Not too hard to check (the answer is yes by the way).
ME_XE?create table test_const(ename varchar2(50) not null,
key_num number not null,
descr varchar2(100),
constraint constraint_test_const unique (ename, key_num));
2 3 4
Table created.
Elapsed: 00:00:00.12
ME_XE?select index_name, index_type
from user_indexes where table_name = 'TEST_CONST';
2
INDEX_NAME INDEX_TYPE
CONSTRAINT_TEST_CONST NORMAL
1 row selected.
Elapsed: 00:00:00.14
ME_XE?
Maybe you are looking for
-
How do I transfer CS5.5 from an old macbook pro to a new one via firewire?
My old MacBook Pro fried its graphics card and I need to transfer all of my data across to my new macBook Pro. I have everything backed up on a hard drive but when I try to open it it says that i can't because t is on a Time Machine Back-up. How do I
-
How can I get my iPod Classic to play playlists in the order I selected them to play ?
I've had my new iPod Classic for a couple of months, and with the help of a couple of third-party books (e.g., the missing manual), I'm getting comfortable with its operation. But here's a baffling issue: It appears there's no way to select, say, thr
-
Setting isolation level to 2.
Hi All, I'm trying to use Isolation level 2 for "read committed" isolation. all I can find is how to set level 3 isolation (by calling setTxnSerializableIsolation(true)). Thanks for your help. ~aviron
-
Problem with update Photoshop, Illustrator and Indesign CS6
Hi all. I have problem with update Photoshop, Illustrator and Indesign CS6 on OSx 10.8.4. Application are OK but update (bug fixies) not working. Update failed. (U44M1P7)
-
Safari doesn't work for one desktop
On 1 desktop safari does not display anything on the line after back/forward arrow and home boxes....cannot enter or click. Safari is fine for all other users on same computer. Please keep help very simple as I have no idea what I'm doing on a comput