11 g client SQL*loader: insert datetime is not working - oracle11g

I have the following data
85566186;DATACONTRACT;1;0;-0.0235;0.6361;0.4448;59;None;N;dnn_auc_0.650_acc_0.670_sensitivity_0.670_specificity_0.640.h5;0.1;;2020-01-26 00:00:00;2020-01-27 19:26:54;18
I need to uploda that into the following oracle table:
CREATE TABLE DATAFOUNDATION.SHAPELY_SCORES_2
(
A INTEGER
, B VARCHAR2(1000)
, C NUMBER
, D VARCHAR2(1000)
, E NUMBER
, F NUMBER
, G NUMBER
, H INTEGER
, I VARCHAR2(4000)
, J VARCHAR2(16)
, K VARCHAR2(1000)
, L NUMBER
, M VARCHAR2(64)
, N DATE
, O DATE
, P INTEGER
)
;
I using the follwing control file:
load data
INFILE 'shaply_test.txt'
INTO TABLE DATAFOUNDATION.SHAPELY_SCORES_2
INSERT
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(
A INTEGER(8) nullif A= BLANKS,
B nullif B = BLANKS,
C DOUBLE nullif C= BLANKS,
D nullif D = BLANKS,
E INTEGER nullif E= BLANKS,
F FLOAT nullif F= BLANKS,
G FLOAT nullif G = BLANKS,
H FLOAT nullif H= BLANKS,
I nullif I= BLANKS,
J nullif J= BLANKS,
K nullif K = BLANKS,
L FLOAT nullif L= BLANKS,
M nullif M= BLANKS,
N TIMESTAMP 'YYYY-MM-DD hh24:mi:ss' nullif N = BLANKS,
O TIMESTAMP 'YYYY-MM-DD hh24:mi:ss' nullif O = BLANKS,
P INTEGER(8) nullif P = BLANKS)
But I am getting the following error (sorry its in German but the message is simple to translate)
SQL*Loader: Release 11.2.0.1.0 - Production on Fr Feb 7 19:14:54 2020
Spaltenname Position Läng Term Eing Datentyp
------------------------------ ---------- ----- ---- ---- --------------------- A FIRST 8 INTEGER
NULL wenn A = BLANKS B NEXT * ; CHARACTER
NULL wenn B = BLANKS C NEXT 8 DOUBLE
NULL wenn C = BLANKS D NEXT * ; CHARACTER
NULL wenn D = BLANKS E NEXT 4 INTEGER
NULL wenn E = BLANKS F NEXT 4 FLOAT
NULL wenn F = BLANKS G NEXT 4 FLOAT
NULL wenn G = BLANKS H NEXT 4 FLOAT
NULL wenn H = BLANKS I NEXT * ; CHARACTER
NULL wenn I = BLANKS J NEXT * ; CHARACTER
NULL wenn J = BLANKS K NEXT * ; CHARACTER
NULL wenn K = BLANKS L NEXT 4 FLOAT
NULL wenn L = BLANKS M NEXT * ; CHARACTER
NULL wenn M = BLANKS N NEXT * ; DATETIME YYYY-MM-DD hh24:mi:ss
NULL wenn N = BLANKS O NEXT * ; DATETIME YYYY-MM-DD hh24:mi:ss
NULL wenn O = BLANKS P NEXT 8 INTEGER
NULL wenn P = BLANKS
Satz 1: Abgelehnt - Fehler in Tabelle DATAFOUNDATION.SHAPELY_SCORES_2,
Spalte N. ORA-01841: (Volles) Jahr muss zwischen -4713
und +9999 liegen und darf nicht 0 sein
Tabelle DATAFOUNDATION.SHAPELY_SCORES_2: 0 Zeilen erfolgreich
geladen. 1 Zeile aufgrund von Datenfehlern nicht geladen. 0 Zeilen
nicht geladen, da alle WHEN-Klauseln fehlerhaft waren. 0 Zeilen
nicht geladen, da alle Felder NULL waren.
Zugewiesener Bereich für Bind-Array: 134912 Bytes (64
Zeilen) Byte in Lese-Puffer: 1048576
Gesamtzahl der übersprungenen logischen Datensätze: 0
Gesamtzahl der gelesenen logischen Datensätze: 1
Gesamtzahl der abgelehnten logischen Datensätze: 1
Gesamtzahl der zurückgewiesenen logischen Datensätze: 0
Lauf begonnen am Fr Feb 07 19:14:54 2020 Lauf beendet am Fr Feb 07
19:14:54 2020
Abgelaufene Zeit: 00:00:00.16 CPU-Zeit: 00:00:00.04
Can anyone please tell me what I am doing wrong here?

I found the solution. There were two problems in my code. 1st is I was using FLOAT/DOUBLE but DECIMAL EXTERNAL was required (link)
2nd problem was with the format of decimal (always a catch with regional settings). I used the following line added for each decimal value column:
"REPLACE(:column_name, '.', ',')"
e.g.,
C DECIMAL EXTERNAL nullif C = BLANKS "REPLACE(:C, '.', ',')",
:).

Related

Transposition Cipher: How to solve

I have a ciphertext as follows, of which I do not know the keylength:
wlna evesy ehudre thnma upbum w onaw-dino olsile tf hndcseoorl foouA. bnsst uho,et r,vweeirh teorf efer tsw lae tsutas sfeccsan,ul eytd hduu sbhe edtmel faut s,b bo nte oefrroeth ad ofhlea fl, in nthdan olwe hacpe lenbe euce rdo edt acsuhutobslinre ut,h tae a sv tmsoeedswitiny cl ardesro ndipipn ino,ng trat reeac edimanthf o chme ay einrh iwhccodha ur stoorn uftentuauac aqnctina dse oy.realgea Lrsea ms nos fl kiceofdan wi tndieer eroscvto edsindre oun a usht-out e,bcoo n wesin o retou befwh,nd mahic vehy alax ep teindre hepe nsecho oftul sebox kybhi eswav chhenbe eeal aref dyrd rereHo.to r ow uaudhyrencli erngie ba hdconee edenvym r fogaeth terdne to h wospt hrheecore ed rveeseshi menss hhigtreeav edimanevo fr m erarytysee e wrot itn to frof hesulmt ohi d,wol cht aud sy e vrn apli. ltaead Hehdev ei blntycanee d irre bwdono ty wonrpesne s,owhf o ad omhare rmy bkall asml aefethe ndtert ohsun uu llaly ogare Osne.e tn he,owhlwat i stms obar pothebl he atteni slglEt nanhisminb, eg le
How would I be able to decipher this transposed ciphertext in a non-manual way like on https://tholman.com/other/transposition/ ?
I believe that the punctuation and spaces matter as well in this ciphertext.

Antlr4 order of token in lexer

lexer grammar
DESC: D | D E S C;
.
.
.
INCREMENTOPTION: S | H | M | D;
parser grammar:
sortExpression: integer? sortFieldList Desc = DESC?;
.
.
.
incrementOption: integer INCREMENTOPTION;
in the case of input 'd' i have a problem.
each of DESC or INCREMENTOPTION token be the upper token in lexer that is matched and the other one not matched
what can i do?!
You will have to do something like this:
sortExpression. : integer? sortFieldList desc?;
incrementOption : integer incrementoption;
desc : DESC | SINGLE_D;
incrementoption : SINGLE_D | SINGLE_S_H_M;
DESC : D E S C;
SINGLE_D : D;
SINGLE_S_H_M : S | H | M;

Remove duplicate line based on column for fixed length file

I have a fixed length file having primary key from 1-8. there is no delimiter. I want to eliminate duplicates by eliminating second occurrence. Look for solutions in unix.
File looks like this:
A00991CCAGXCD K 9999PHLX CANADIAN DOLLAR F
G0084W10%AEURN 4612EURONAV NV ANTWERPEN F
D1819089%ADB 6021DEUTSCHE BANK AG F
G0084W10GAADNT 6799ADIENT PLC F
D1F19089NADB 6021DEUTSCHE BANK AG F
Output extected is:
A00991CCAGXCD K 9999PHLX CANADIAN DOLLAR F
G0084W10%AEURN 4612EURONAV NV ANTWERPEN F
D1819089%ADB 6021DEUTSCHE BANK AG F
D1F19089NADB 6021DEUTSCHE BANK AG F
Short awk solution:
awk '!a[substr($1,1,8)]++' file
The output:
A00991CCAGXCD K 9999PHLX CANADIAN DOLLAR F
G0084W10%AEURN 4612EURONAV NV ANTWERPEN F
D1819089%ADB 6021DEUTSCHE BANK AG F
D1F19089NADB 6021DEUTSCHE BANK AG F
substr($1,1,8) - returns 8-character-long substring from the 1st field $1 (starting from the 1st char)
!a[...]++ - considering only the first occurence of unique array index

Problems with scan() function in R

I am trying to do a simple process to get values from console with scan()
function in R.
The above R code works well:
funent <- function(){
val <- scan(,,1)
return(as.character(val))
}
print("Seleccione: 1. consulta, 2.cirugia")
tipo <- funent()
But when I add more code below it doesn't work. The execution doesn't stop in scan.
funent <- function(){
val <- scan(,,1)
return(as.character(val))
}
print("Seleccione: 1. consulta, 2.cirugia")
tipo <- funent()
while((tipo < 1 | tipo >2 )){
if (tipo < 1 | tipo >2 ) {
print("Introduzca 1(consulta) o 2(cirugia)")
tipo <- funent()
}
}
Is there anything wrong in my R code?
Nothing is wrong with your code. The execution doesn't stop in scan because the value of tipo is 1 or 2. It works as expected when tipo is outside that range:
tipo = 0
while((tipo < 1 | tipo >2 )){
if (tipo < 1 | tipo >2 ) {
print("Introduzca 1(consulta) o 2(cirugia)")
tipo <- funent()
}
}
[1] "Introduzca 1(consulta) o 2(cirugia)"
1:

retrieve the value of a timestamp field with adodb - how to read a byte array from classic asp

I'm working with asp and adodb, querying a database (ms sql 2005)
I have a field named stamp, of type timestamp
in asp I get the following
field.ActualSize: 8
field.DefinedSize:
field.Name: Stamp
field.Type: adBinary (128)
field.Attributes: 528 (adFldFixed (16) + adFldRowVersion (512) )
(so adFldLong is NOT turned on, so I can't use getchunk method!)
http://msdn.microsoft.com/en-us/library/ms676678(VS.85).aspx
At the debugger, if I type field.value I get the following
? field.value
{...}
(0): 0
(1): 0
(2): 0
(3): 0
(4): 0
(5): 35
(6): 163
(7): 124
That is what I want to GET!!!! but I don't know how to do it...
I can assign it to a variable, but I can't get each element
I tried with
? cstr( field.value )
""
? field.value(0)
Número de argumentos erróneo o asignación de propiedad no válida: 'field.value'
(wrong number of arguments)
? vartype( field.value )
8209 ( 8192-vbArray + 17-vbByte )
So, the problem is I have an array of bytes, well, how do I read it???
well, I've found it...
http://www.ureader.com/msg/16755039.aspx
I had to use
h = hex( ascb( midb( barray, c, 1 ) ) )
to convert it to hex...
so I made something like this
s = ""
for c = lbound( barray ) + 1 to ubound( barray ) + 1
h = hex( ascb( midb( barray, c, 1 ) ) )
h = padl( h, 2, "0" )
s = s & h & " "
next

Resources