Home » RDBMS Server » Server Utilities » SQL*Loader: constraints and PL/SQL function (merged by LF)
SQL*Loader: constraints and PL/SQL function (merged by LF) [message #255512] |
Wed, 01 August 2007 01:51 |
annu-agi
Messages: 238 Registered: July 2005 Location: Karachi
|
Senior Member |
|
|
hi experts
i am new with sql loader ... and i am stuck in one problem please help me out
my table structure is like this
-------------------------------
com_cd varchar2(10),--- forign key con. with com_info
trans_date date,
descript varchar2(10),
amount number(14,2),
trans_cd varchar2(10),--- Primary key (com_Cd,trans_no)
--- fill with LPAD(ROWNUM, 10, '0')
dk_no varchar2(10),--- Unique
DATA is like
------------
"01",20091205,"machanics",700,100001,"fd-50"
"01",20070405,"tecnicals",500,100002,"df-56"
"01",20060205,"machanics",400,100003,"fd-46"
"01",20070905,"machanics",800,100004,"fd-55"
"01",20070304,"research",700,100005,"fd-54"
"01",20070501,"research",700,100006,"fd-79"
"01",20070604,"research",700,100007,"fd-15"
"01",20070909,"tecnicals",600,100008,"fd-65"
Script is like
--------------
load data
infile 'M:\dbf_only\ms_trans.TXT'
into table ms_trans
fields terminated by ","
optionally enclosed by '"'
trailing nullcols
(
com_Cd char(10) "01",
trans_Date date 'yyyymmdd'
descript,
amount,
trans_cd char(10) "LPAD(ROWNUM, 10, '0')",
dk_no
)
error shows
------------
Record 1: Rejected - Error on table MS_TRANS.
ORA-02291: integrity constraint (IGLOO.MS_TRANS_FK21185950593156) violated - parent key not found
my question is how to avoid this error .. while i am giving all the data in all rows and columns .. and nothing i left blank .. i know this is an error for forign key .. but u see i m putting data also .. i also trid this by removing fk constraint .. then it shows error on uniqe and when i tried to remove uniqe constraint is shows error on Pk.
Any solutions ..??? Please help me out .. in breif
regards
anwer
|
|
|
|
|
|
|
|
|
|
sql loader data with plsql function [message #255647 is a reply to message #255512] |
Wed, 01 August 2007 06:57 |
annu-agi
Messages: 238 Registered: July 2005 Location: Karachi
|
Senior Member |
|
|
hi experts
i just want to replace my one column with plsql function bt it give me error ..pleae help me out
load data
infile 'M:\dbf_only\ms_dtl.TXT'
into table ms_trans
replace
fields terminated by ","
optionally enclosed by '"'
trailing nullcols
(
com_Cd CONSTANT "01",
trans_Date date 'yyyymmdd',
descript,
amount,
trans_cd char(10) "LPAD(ROWNUM, 10, '0')",
dk_no
)
it give me error
Record 01: Rejected - Error on table MS_DTL, column TRANS_CD.
ORA-00984: column not allowed here
what should i do for .. suggust me
|
|
|
Re: sql loader data with plsql function [message #255674 is a reply to message #255647] |
Wed, 01 August 2007 08:23 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
rownum is a pseudo-column, hence not allowed in a SQL*Loader control file, or at least I would think. I have never attempted to even think of using it there.
I'd create a sequence and use NEXTVAL instead.
|
|
|
|
|
|
|
Goto Forum:
Current Time: Wed Dec 25 09:45:58 CST 2024
|