Forcing a Default Value on Import

Discussion of open issues, suggestions and bugs regarding database management and development tools for Oracle
Post Reply
cjeliot
Posts: 1
Joined: Thu 12 Dec 2013 22:34

Forcing a Default Value on Import

Post by cjeliot » Thu 12 Dec 2013 22:47

I thought I saw a similar post under the MySQL tool on 11/27/2012 called "BUG: before-insert trigger gets ignored while bulk-insert / import" but could not see what the resolution was so sorry if this has been answered.

I have an oracle table with an insert trigger on the primary key (ID). When I try to import a CSV file, I am asked to enter a default value for the ID field. If I do this, I get an error on the second record that the key is not unique. I am only loading one field from the CSV file.

Table:
CREATE TABLE TBLRESCATEGORY (
ID NUMBER(10, 0) NOT NULL,
CATEGORY_NAME VARCHAR2(50 BYTE),
CAT_START_DATE DATE,
CAT_END_DATE DATE,
CONSTRAINT PK_TBLRESCATEGORY PRIMARY KEY (ID),
CONSTRAINT UV_RESCATEGORY_NAME UNIQUE (CATEGORY_NAME)

Trigger:
CREATE OR REPLACE TRIGGER RES_CATEGORY_INS
BEFORE INSERT
ON TBLRESCATEGORY
FOR EACH ROW
BEGIN
IF inserting
THEN
IF :NEW."ID" IS NULL
THEN
SELECT SEQ_RES_MSTR.NEXTVAL
INTO :NEW."ID"
FROM dual;
END IF;
END IF;
END;
)

Thanks

alexa

Re: Forcing a Default Value on Import

Post by alexa » Mon 16 Dec 2013 15:26

We are currently reviewing the post you have submitted and will answer you as soon as possible.

alexa

Re: Forcing a Default Value on Import

Post by alexa » Tue 17 Dec 2013 13:21

Could you please provide us the following information:

1. Imported *.csv file.
2. *.dit data import template file with your specific settings. To generate the .dit file, please complete the Data Import wizard and click the 'Save Template' button being on the last page of the Data Import wizard.

You can send a reply straight to our support system at supportATdevartDOTcom or alexaATdevartDOTcom, so we will keep further correspondence with you via e-mail.

Post Reply