ORA-00001: unique constraint violated


 
Thread Tools Search this Thread
Operating Systems Solaris ORA-00001: unique constraint violated
# 1  
Old 04-28-2014
ORA-00001: unique constraint violated

Am trying to install a account script in oracle 8i and I keep getting ORA-00001: unique constraint violated as the screen shot below shows so am wondering how do i fix this i have posted the full code that is the issue.

i hope some one can help me, thanks a lot

Image


Code:
REM ------------------------------------------------------------------------
REM                           ACCESS CONTROL TABLES
REM ------------------------------------------------------------------------

CREATE SEQUENCE gam_product_ruleset_id_seq
	START WITH 1000
	NOCYCLE
/

CREATE SEQUENCE gam_product_rule_id_seq
	START WITH 1000
	NOCYCLE
/

CREATE TABLE gam_product_rulesets (
        ruleset_id NUMBER(10)
		CONSTRAINT gprs_pk
		PRIMARY KEY
		USING INDEX
		TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited),
        ruleset_name VARCHAR2(40) NOT NULL
) TABLESPACE gam_tab STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

REM Primary key constraint causes a unique index to be built.

CREATE TABLE gam_product_ruleset_types (
        target_type	NUMBER(10)
		CONSTRAINT gprtyp_pk
		PRIMARY KEY
		USING INDEX
		TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited),
        description	VARCHAR2(100) NOT NULL
) TABLESPACE gam_tab STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

REM Primary key constraint causes a unique index to be built.


CREATE TABLE gam_product_ruleset_targets (
        target_type	CONSTRAINT gprt_tt
		NOT NULL REFERENCES gam_product_ruleset_types
		ON DELETE CASCADE, target_id VARCHAR2(100)
		NOT NULL, ruleset_id CONSTRAINT gprt_rs_fk NOT NULL REFERENCES gam_product_rulesets ON DELETE CASCADE
) TABLESPACE gam_tab STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

ALTER TABLE gam_product_ruleset_targets ADD (
	CONSTRAINT gprt_unique
	UNIQUE (target_type, target_id, ruleset_id)
	USING INDEX
	TABLESPACE gam_ind
	STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
)
/

CREATE INDEX gam_product_rsta_targ ON gam_product_ruleset_targets (
	target_type, target_id
)
TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

CREATE TABLE gam_product_rule_tests (
        rule_test NUMBER(10)
		CONSTRAINT gprtst_pk
		PRIMARY KEY
		USING INDEX
		TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited),
        description	VARCHAR2(100) NOT NULL
) TABLESPACE gam_tab STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

INSERT INTO gam_product_rule_tests (rule_test, description) VALUES (0, 'Always true, no arguments');
INSERT INTO gam_product_rule_tests (rule_test, description) VALUES (1, 'Presence of product <test arg 0>');
INSERT INTO gam_product_rule_tests (rule_test, description) VALUES (2, 'Balance of element <test arg 0> less than [test arg 1, 0 if none]');

CREATE TABLE gam_product_rule_actions (
        rule_action	NUMBER(10)
		CONSTRAINT gpra_pk
		PRIMARY KEY
		USING INDEX TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited),
        description	VARCHAR2(100) NOT NULL
) TABLESPACE gam_tab STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

INSERT INTO gam_product_rule_actions (rule_action, description) VALUES (0, 'Deny access to desired resource');
INSERT INTO gam_product_rule_actions (rule_action, description) VALUES (1, 'Allow access, but warn with message <action arg 0>');
INSERT INTO gam_product_rule_actions (rule_action, description) VALUES (2, 'Allow access, with optional message [action arg 0]');
INSERT INTO gam_product_rule_actions (rule_action, description) VALUES (3, 'Purchase product <action arg 0>');


CREATE TABLE gam_product_rules (
        rule_id	NUMBER(10)
		CONSTRAINT gpr_pk
		PRIMARY KEY
		USING INDEX TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited), 
        ruleset_id	CONSTRAINT gpr_rs_fk NOT NULL REFERENCES gam_product_rulesets ON DELETE CASCADE, 
        rule_priority NUMBER(10) NOT NULL, 
        rule_truth CHAR(1) CONSTRAINT gpr_truth_chk CHECK (rule_truth IN ('Y', 'N')), 
        rule_test CONSTRAINT gpr_t_fk NOT NULL REFERENCES gam_product_rule_tests, 
        rule_action	CONSTRAINT gpr_a_fk NOT NULL REFERENCES gam_product_rule_actions
) TABLESPACE gam_tab STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

CREATE INDEX gam_product_rules_rs ON gam_product_rules (
	ruleset_id
)
TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0
			MAXEXTENTS unlimited)
/

CREATE TABLE gam_product_rule_args (
        rule_id	CONSTRAINT gpra_r_fk NOT NULL REFERENCES gam_product_rules ON DELETE CASCADE,
        rule_arg_type CHAR(1) CONSTRAINT gpra_type_chk CHECK (rule_arg_type IN ('A', 'T')), 
        rule_arg_index	NUMBER(10) NOT NULL, 
        rule_arg_value	VARCHAR2(255) NOT NULL
) TABLESPACE gam_tab STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

ALTER TABLE gam_product_rule_args ADD (
	CONSTRAINT gpra_unique UNIQUE (rule_id, rule_arg_type, rule_arg_index)
	USING INDEX TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
)
/

CREATE INDEX gam_product_ra_id ON gam_product_rule_args (
	rule_id
)
TABLESPACE gam_ind STORAGE (INITIAL 128K NEXT 128K PCTINCREASE 0 MAXEXTENTS unlimited)
/

# 2  
Old 04-29-2014
This is telling you that you have defined the tables with a column that must be unique and you are trying to insert a record that duplicates the value in this column of another record.

You have set the constraint for a reason, so you may need to check why this was done in the first place.



Robin
This User Gave Thanks to rbatte1 For This Post:
# 3  
Old 04-29-2014
it turned out when i dropped my tables it never fully dropped them that's what caused it, all i did to fix it was to remake my database and it imported just fine now i got a other issue ill be posting.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Red Hat

Ora-27603:ora-27626:

Hi, User claim that job is running slow from their end. I DBA found in database the below errors in alert log file. ORA-27603: Cell storage I/O error, I/O failed on disk o/192.168.10.3/RECO_DM01_CD_01_drm01 at offset 13335789568 for data length 1048576 ORA-27626: Exadata error: 2201 (IO... (2 Replies)
Discussion started by: Maddy123
2 Replies

2. UNIX for Advanced & Expert Users

[SOLVED] LDAP Constraint Violation while changing password

Hello there, I hope that I am posting in the right section here, please advise if I posted wrong. I currently try to change passwords in our Active Directory Envoirenment via LDAP on Linux since the users in question do not have access to a windows-machine and we want to keep it that way. ... (0 Replies)
Discussion started by: henryford
0 Replies

3. Shell Programming and Scripting

Eliminating space constraint in grep

here in the below code just a space between 'Info' and '(' is showing that the patter doesnt match... echo "CREATE TABLE Info (" | grep -i "CREATE TABLE Info (" | wc | awk -F' ' '{print $1}' 1 echo "CREATE TABLE Info (" | grep -i "CREATE TABLE Info (" | wc | awk -F' ' '{print $1}' 0 ... (9 Replies)
Discussion started by: vivek d r
9 Replies

4. UNIX for Advanced & Expert Users

grep all ORA errors except one ORA error

Hi - I am trying to grep all "ORA" errors in a log files.I have to grep all ORA errors except one error for example ORA-01653.How can exclude that error in "grep" command? In following "grep" command I want to exclude "ORA-01653" error grep -i ORA alert.log >>/tmp/ora_errors.txt ... (7 Replies)
Discussion started by: Mansoor8810
7 Replies

5. Solaris

maxuprc and maxusers - ORA-27300, ORA-27301, ORA-27302

Hi all, Am intermittently getting the following errors on one of my databases. Errors in file /oracle/HRD/saptrace/background/hrd_psp0_13943.trc: ORA-27300: OS system dependent operation:fork failed with status: 12 ORA-27301: OS failure message: Not enough space ORA-27302:... (1 Reply)
Discussion started by: newbie_01
1 Replies

6. Shell Programming and Scripting

search and replace combination of two words...with a constraint

Hi I have 100 files in my directory. Please help me how to do in Unix or any other scriptin lanuages. I want to replace all occurances of "goutham" to goutham_ind ONLY if the file contains the word "goutham" with the word "engineer"; for eg----test1 is a file contains the following inf; goutham... (6 Replies)
Discussion started by: nandugo1
6 Replies

7. Shell Programming and Scripting

Unique constraint violated within stored procedure executed from Perl

Hi! I got an strange trouble executing a stored procedures that goes inserting line by line on a table. I mus integrate it with perl for an specific task... the hole process is controlled by e Perl script that: Load a text file calling sqlldr. Call a stored procedure that process the... (2 Replies)
Discussion started by: jparra
2 Replies

8. Shell Programming and Scripting

get part of file with unique & non-unique string

I have an archive file that holds a batch of statements. I would like to be able to extract a certain statement based on the unique customer # (ie. 123456). The end for each statement is noted by "ENDSTM". I can find the line number for the beginning of the statement section with sed. ... (5 Replies)
Discussion started by: andrewsc
5 Replies
Login or Register to Ask a Question