Concat two values using sqlldr throws error - oracle
I have a table to which i want to load data using sqlldr,
The DDL of the table is as below,
create table abc.AccountDataDump (
CIF_ID varchar2(20),
ACCOUNT_NO varchar2(30),
TURNOVER number(15,2),
CASH_WITHDRAWAL number(15,2),
CASH_DEPOSIT number(15,2),
MONTH number(2),
YEAR number(4) );
I have the ctl file as below,
LOAD DATA
INFILE '/home/sijo/Downloads/testcash/CXPS_CASHDATA_MONTHLY_APR21.TXT'
badfile '/home/sijo/Downloads/testcash/cash.bad'
discardfile '/home/sijo/Downloads/testcash/cash.rej'
TRUNCATE INTO TABLE CXPSADM_sijo_47z50.AccountDataDump
FIELDS TERMINATED BY '~|'
TRAILING NULLCOLS
(
"CIF_ID",
"ACCOUNT_NO" "A_F_||:ACCOUNT_NO",
"TURNOVER",
"CASH_WITHDRAWAL",
"CASH_DEPOSIT" ,
"MONTH" ,
"YEAR"
)
Basically i am trying to prepend 'A_F_' to the "ACCOUNT_NO" but it is throwing the error as below. The account number in the in file is proper
"Record 1: Rejected - Error on table CXPSADM_SIJO_47Z50.ACCOUNTDATADUMP, column "ACCOUNT_NO".
ORA-00984: column not allowed here"
If i replace "ACCOUNT_NO" "A_F_||:ACCOUNT_NO", with just "ACCOUNT_NO", then it is working fine. Please help
Replace
"ACCOUNT_NO" "A_F_||:ACCOUNT_NO",
by
ACCOUNT_NO "'A_F_'||:ACCOUNT_NO",
Let me show you how it works
Demo
[ftpfdm#scglvdoracd0006 ~]$ cat t.ctl
LOAD DATA
INFILE '/home/ftpfdm/t.dat'
badfile '/home/ftpfdm/t.bad'
discardfile '/home/ftpfdm/t.dsc'
TRUNCATE INTO TABLE TEST1.LOADER_EXAMPLE
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(
CIF_ID,
ACCOUNT_NO "'A_F_'||:ACCOUNT_NO"
)
[ftpfdm#scglvdoracd0006 ~]$ cat t.dat
1;A2
2;B2
[ftpfdm#scglvdoracd0006 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 1 11:37:12 2021
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
SQL> truncate table test1.loader_Example ;
Table truncated.
SQL> desc test1.loader_example
Name Null? Type
----------------------------------------- -------- ----------------------------
CIF_ID NUMBER
ACCOUNT_NO VARCHAR2(50)
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
[ftpfdm#scglvdoracd0006 ~]$ sqlldr control=t.ctl
Username:/ as sysdba
SQL*Loader: Release 19.0.0.0.0 - Production on Wed Sep 1 11:37:32 2021
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
Path used: Conventional
Commit point reached - logical record count 2
Table TEST1.LOADER_EXAMPLE:
2 Rows successfully loaded.
Check the log file:
t.log
for more information about the load.
[ftpfdm#scglvdoracd0006 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Sep 1 11:37:40 2021
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
SQL> select * from test1.loader_example ;
CIF_ID ACCOUNT_NO
---------- --------------------------------------------------
1 A_F_A2
2 A_F_B2
SQL>
Related
Oracle 19.5 giving ORA-39358 for 19.0 dump
I am importing 19.0 dump (exported on Oracle 19.0c) on Oracle 19.5c oracle. But it give strange message as below, Import: Release 19.0.0.0.0 - Production on Wed Mar 23 05:46:48 2022 Version 19.5.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production ORA-39002: invalid operation ORA-39358: Export dump file version 19.0.0.0.0 not compatible with target version 12.2.0.0.0 Can anyone explain. Here is the compatible parameter I have: \`SQL\> SELECT name, value FROM v$parameter WHERE name = 'compatible'; 2 NAME - VALUE - compatible 12\.2.0 \`
Make liquibase output be spooled to the current spool file when running using sqlcl
Assume we have the following set of scripts: test.sql create or replace view asdas as select 1 val from dual / controller.xml <?xml version="1.0" encoding="UTF-8"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd"> <changeSet author="tim" id="01_tab1_seq" runAlways="true" > <sqlFile dbms="oracle" endDelimiter=";" path="test.sql" splitStatements="true" stripComments="false"/> </changeSet> </databaseChangeLog> main.sql spool output.log lb update -changelog controller.xml spool off exit When calling main.sql file I get the following output: roman#UBUNTU-LT:/mnt/c/Users/%USERNAME%/Desktop/preset$ sql testuser/testuser#dev-db1 #main.sql SQLcl: Release 21.1 Production on Thu Jul 22 16:36:34 2021 Copyright (c) 1982, 2021, Oracle. All rights reserved. Last Successful login time: Thu Jul 22 2021 16:36:37 +03:00 Connected to: Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.7.0.0.0 SQL> set serveroutput on SQL> set scan on SQL> set linesize 4000 SQL> spool output.log SQL> lb update -changelog controller.xml ScriptRunner Executing: create or replace view asdas as select 1 val from dual /Liquibase Executed:create or replace view asdas as select 1 val from dual / ######## ERROR SUMMARY ################## Errors encountered:0 SQL> spool off SQL> exit Disconnected from Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production Version 19.7.0.0.0 And what I see in output.log: SQL> lb update -changelog controller.xml ######## ERROR SUMMARY ################## Errors encountered:0 SQL> spool off Instead I want to see the whole log output that I see on the screen. Can I somehow force sqlcl to write it to the file I spool to? I tried to add -log option to lb update but sqlcl just creates file with something looking like timestamp at the end of the name but this file is empty.
This would be a bug. Whatever you see in the console should be going into the SPOOL file. I'll log the bug for you - thanks for the test case & report!
VARCHAR2 field and NVARCHAR2 exsit in the same table,the former is correct,the latter was garbled
the database A field Type is: select column_name,data_type From all_tab_columns ; COLUMN_NAME DATA_TYPE ------------------------------------ NAME VARCHAR2 ID_ISSUE_PLACE VARCHAR2 NATIONALITY NVARCHAR2 I want to export a table with expdp: expdp abc/123 tables=A.CUST:PARTNUM_0 exclude=grant,index,contraint,statistics,trigger DIRECTORY=DATATMP filesize=100M dumpfile=expdp_%U.dmp parallel=4 cluster=N COMPRESSION=DATA_ONLY Then,I import the dmp file to my local oracle,the field 'NATIONALITY' is correct , but the other field is garbled. impdp abc/123 DIRECTORY=DATATMP DUMPFILE=expdp_01.dmp [oracle#db01 tmp]$ impdp bi71/bi71 DIRECTORY=datatmp DUMPFILE=expdp_01.dmp Import: Release 11.2.0.1.0 - Production on Tue Sep 6 11:18:05 2016 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Master table "A"."SYS_IMPORT_FULL_01" successfully loaded/unloaded Starting "A"."SYS_IMPORT_FULL_01": abc/******** DIRECTORY=datatmp DUMPFILE=expdp_01.dmp Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/TABLE_DATA . . imported "A"."CUST":"PARTNUM_0" 5.990 MB 78037 rows Statement:Not a windows client problems,because the vietnamese charecter has been displayed properly.Here with reason screenshot windows client, is to make the results better clarity. screenshot I found a rule,once vietnamese nationality in this line appears,the field NAME,ID_ISSUE_PLACE are garbled. How to resolve? thanks(^_^).
gives many errors when using expdp command
expdp is giving the following errors. C:\db>expdp SYSTEM/xxx#orcl directory=dump_dir dumpfile=anew.dmp log=export.log schemas=anew Export: Release 11.2.0.4.0 - Production on Qua Fev 17 17:09:00 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ORA-31626: job does not exist ORA-31637: cannot create job SYS_EXPORT_SCHEMA_01 for user SYSTEM ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95 ORA-06512: at "SYS.KUPV$FT_INT", line 798 ORA-39244: Event to disable dropping null bit image header during relational select ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86 ORA-06512: at "SYS.KUPC$QUE_INT", line 1840 ORA-00955: name is already used by an existing object There is no orphan jobs in my system: select * from dba_datapump_jobs; no rows selected Any ideas about this error?
The temporary table created every time a datapump is started has not been automatically dropped. Solution 1: drop table sys.job_name with sys rights Solution 2: use a .par file and put entries like below (change to suit your job): DIRECTORY=dump_dir DUMPFILE=anew.dmp LOGFILE=export.log PARALLEL=16 SCHEMAS=anew JOB_NAME=new_expdp <----- this has to change
SQL*Loader error ORA-00604 and ORA-02248
I've a Problem with Oracle's SQL*Loader. SQL*Loader: Release 11.2.0.3.0 - Production on Tue Feb 11 14:32:00 2014 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. SQL*Loader-128: unable to begin a session ORA-00604: Fehler auf rekursiver SQL-Ebene 1 ORA-02248: Ungültige Option für ALTER SESSION This Errormessage occurs in the Errorlog after execute sqlldr with the following control and data file: sqlldr statement: sqlldr userid=%PW%/%Name%#%DBname% control=ABGRENZUNG_control.dat log=loader.log ABGRENZUG control file load data INFILE 'ABGRENZUNG.dat' INTO TABLE ABGRENZUNG APPEND FIELDS TERMINATED BY ',' TRAILING NULLCOLS (AVG_RESTSCHULD,DATUM,DISAGIO,GEBUEHR,NOMZINS,REF_KEY,RESTSCHULD,STEUER_TYP,TYP,ZINSBETRAG,ZINSTAGE) ABGRENZUNG.dat: ,20040630,0,0,,7514,3091209.0914799999,"S","T",11147.31048, ,20040731,0,0,,7514,3105526.7633799999,"S","T",17645.6519, ,20040831,0,0,,7514,3119926.1653200001,"S","T",17727.38194, ,20040930,0,0,,7514,3134407.7638500002,"S","T",17809.57853, ,20041031,0,0,,7514,3148972.0281699998,"S","T",17892.24432, ,20041130,0,0,,7514,3163619.43016,"S","T",17975.38199, ,20041231,0,0,,7514,3178350.44441,"S","T",18058.99425, ,20050131,0,0,,7514,3193165.5482000001,"S","T",18143.08379, ,20050228,0,0,,7514,3208065.2215300002,"S","T",18227.65334, ,20050331,0,0,,7514,3223049.9471700001,"S","T",18312.70564, ,20050430,0,0,,7514,3238120.21062,"S","T",18398.24345, ,20050531,0,0,,7514,3253276.5001599998,"S","T",18484.26954, ,20050630,0,0,,7514,3268519.3068400002,"S","T",18570.78669, ,20050731,0,0,,7514,3283849.1245499998,"S","T",18657.79771, ,20050831,0,0,,7514,3299266.44997,"S","T",18745.30542, ,20050930,0,0,,7514,3314771.7826299998,"S","T",18833.31265, ,20051031,0,0,,7514,3330365.6248900001,"S","T",18921.82226, ,20051130,0,0,,7514,3346048.4819899998,"S","T",19010.83711, ,20051231,0,0,,7514,3361820.8620799999,"S","T",19100.36008, ,20060131,0,0,,7514,3377683.27617,"S","T",19190.39409, ,20060228,0,0,,7514,3393636.2382,"S","T",19280.94203, ,20060331,0,0,,7514,3409680.2650600001,"S","T",19372.00686, ,20060430,0,0,,7514,3425815.8765699998,"S","T",19463.59151, ,20060531,0,0,,7514,3442043.5955400001,"S","T",19555.69896, ,20060630,0,0,,7514,3458363.9477300001,"S","T",19648.33219, before executing the sqlldr statement I set these options. set nls_lang=AMERICAN_AMERICA.WE8MSWIN1252 set nls_date_format='YYYYMMDD'
It seems that the problem occurs because of the NLS parameters. There must be a conflict with the nls_session(or database)_parameters.