SQL Loader with null values
Dear friends,I have comma-delimited .dat files. Here is the example.
abc, xyz, 456
ase, asd, 890
I have no problem loading using sql loader under normal circumstances.When a null value somewhere, for example:
abc, , 456
ase, asd, 890
or, xyz, 456
ase, asd, 890
I could not load them.How can I fix this error?
Any suggestion?
I am using Oracle 10 g R2 running on Windows Server 2003
That's how I connect
$sqlldr userid=userid/password control=d:\load\controlfile\table_name.ctl log=D:\load\log\tablename.log resumable = true errors=0
It is a way the contorl file looks likeLOAD DATA INFILE 'D:\load\dat\tablename.dat' BADFILE 'D:\load\bad\tablename.bad' DISCARDFILE 'D:\load\dat\discard\tablename.dsc'
INSERT INTO TABLE tablename FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS( col1, col2, col3)
{code}
How can I handle this?
Please advice.
Thanks in advance.
Nith
Edited by: user645399 on Jun 14, 2010 1:38 PM
Edited by: user645399 on Jun 14, 2010 1:38 PM
Try column_name '
Tags: Database
Similar Questions
-
Hello
I'm using Oracle 11 g. I have a table with an id of 3, node, the value column. Combination of the column id and node, that must be taken account for deletion on the registers.
Here, I need to delete lines with the NULL value in the value column. If for a combination of id and node with non-null values, then I need to delete rows with a null value for this combination.
If the combination of id, node is not null value then this records should not delete.
Below table, I need to remove the second row, for which is a value not zero VOICE CAL '10' is there, so I need to delete the row with null values. (VOICE, CAL, NULL)
Network, FL, there is no value is non-null then I should NOT delete this line.
This table is to have 100 s of this association, we can delete data in a single delete query?
Or how I can delete rows with nulls for this combination.
Tab1
VALUE OF THE NŒUD ID
VOICE CAL 10
VOICE CAL NULL
NETWORK NULL FLThank you
Hello
oradba11 wrote:
Hello
I'm using Oracle 11 g. I have a table with an id of 3, node, the value column. Combination of the column id and node, that must be taken account for deletion on the registers.
Here, I need to delete lines with the NULL value in the value column. If for a combination of id and node with non-null values, then I need to delete rows with a null value for this combination.
If the combination of id, node is not null value then this records should not delete.
Below table, I need to remove the second row, for which is a value not zero VOICE CAL '10' is there, so I need to delete the row with null values. (VOICE, CAL, NULL)
Network, FL, there is no value is non-null then I should NOT delete this line.
This table is to have 100 s of this association, we can delete data in a single delete query?
Or how I can delete rows with nulls for this combination.
Tab1
VALUE OF THE NŒUD ID
VOICE CAL 10
VOICE CAL NULL
NETWORK NULL FLThank you
You can do this in a single DELETE statement (it is not a request), using an EXISTS or IN the subquery. For example:
REMOVE table_x m
WHERE the value IS NULL
AND THERE ARE)
SELECT 0
FROM table_x s
WHERE s.id = m.id
AND s.node = m.node
AND s.value IS NOT NULL
)
;
If you would care to post CREATE TABLE and INSERT instructions for the sample data, and then I could test it.
-
How to display the line empty as a line with null values
Hi all
Pls advise me if it is possible to use a single query statement to display
Empty row (i.e. not a single return line) as a line with null values.
For example,.
Select the names of names_mst whose name = "sgasfgs".
Result:
Names of
=====
< null >Hello
If you desire to join external to double, as shown below, you still get at least a line of productionSELECT nm.names FROM dual LEFT OUTER JOIN names_mst nm ON nm.name='sgasfgs';
-
Throw the records with null values columns
Hi all.
Anyone know how to dispose of records containing null column values?
In the target table, I have the set Null option? with "N"... then the process sqlldr load some records. I need to load all of this without the records with null column values. by result, if the field X is null then load the file.
Kind regards.
Published by: ASzo on 05/06/2013 12:37
Published by: ASzo on 05/06/2013 12:38
Published by: ASzo on 05/06/2013 12:42load data
INFILE...
in the table...
When x! = ''
fields completed by...
(x ...) -
Alter the State of Session? -Apex form publishes text with null value
Recently I discovered a problem with our Apex facility in which all selected as source for a text field value will eventually be displayed as a null value in the database.
We run APEX version 3.2 in an Oracle 10.2.0.4 database using Oracle HTTP Server from 10 g companion disc.
At first glance, everything seems to work as expected; I created a simple table called "oracle_sr" with 2 columns, as both not null:
SQL > desc capacity.oracle_sr
Name Null? Type
ORACLE_SR_ID NOT NULL NUMBER
TIMESTAMP NOT NULL DATE
In APEX, the form wizard has been used to create a form on this table.
After execution of the pages and you enter a value for the timestamp field, I can create folders without problem.
The question arises when I choose a source for the timestamp field value.
All the source options causes the same error (including a static value) so I'll focus on the SQL query to the source as:
Select sysdate double;
This should replace the date system in the area of text timestamp when the page is executed.
As expected, the value appears in the text box, but when I submit the form to create the folder I get the error:
ORA-01400: cannot insert NULL into ('ABILITY'. "" "" ORACLE_SR '. "" TIMESTAMP")
I have worked with APEX for quite awhile and have successfully used this technique in many applications but just to begin to see this error in recent days. What's particularly odd about this message is by default postings "not null" created by the form wizard sees timestamp class as having a value. Session state information included below reports a value yet the database is to launch the ORA-01400.
Someone has a similar problem? I have spent a good amount of time to try looking for this problem but can't seem to find any similar messages.
I have included the release of my test page, debugging from what I see, it seems to be a value associated with the filed timestamp:
0.00: a C C E P t: request = "CRΘER."
0.00: metadata: go look up the definition and application shortcuts
0.00: NLS: wwv_flow.g_flow_language_derived_from = FLOW_PRIMARY_LANGUAGE: wwv_flow.g_browser_language = en - us
0.00: alter session set nls_language = "AMERICAN."
0.00: alter session set nls_territory = 'AMERICA '.
0.00: NLS: CSV charset = WE8MSWIN1252
0.00:... "NLS: decimal separator Set =". »
0.00:... NLS: Set NLS Group separator = ",".
0.00:... NLS: Date Format Set = "DD-MON-RR.
0.01:... Setting session time_zone in-06: 00
0.01: setting NLS_DATE_FORMAT application date format: DD-MON-RR
0.01:... NLS: Date Format Set = "DD-MON-RR.
0.01: fetch database session state
0.01:... Check the owner of the 2303701116904676 session
0.01: setting NLS_DATE_FORMAT application date format: DD-MON-RR
0.02:... NLS: Date Format Set = "DD-MON-RR.
0.02:... Check for expiration of the session:
0.02:... Metadata: Page Fetch, calculation, process and branch
0.02: session: extract information from session header
0.02:... Metadata: Retrieve the attributes of the page for application 109, page 50
0.02:... Validate page affinity point.
0.02:... Check off the items hidden_protected.
0.03:... Check authorization security systems
0.03: session state: Save elements of form and p_arg_values
0.03: *... Session state: you save newValue of the object "P50_ORACLE_SR_ID" = "" "escape_on_input ="N"* 0.03: *..." " Session state: you save the object "P50_TIMESTAMP" = newValue ' 26 May 09 "" escape_on_input = "N" * ""»
0.03:... Session state: Save "P0_CURRENT_PERSONNEL_ID" - registration of same value: "1."
0.03:... Session state: Save "P0_OFFSET" - registration of same value: "0".
0.03:... Session state: Save "P0_ACTIVE_WEEK" - registration of same value: "24 May 09".
0.03: point of treatment: ON_SUBMIT_BEFORE_COMPUTATION
0.03: branch point: BEFORE_COMPUTATION
0.03: point of calculation: AFTER_SUBMIT
0.03: tabs: make the connection for the tab queries
0.03: branch point: BEFORE_VALIDATION
0.03: perform validations:
0.03:... Point Not Null Validation: P50_TIMESTAMP
0.04: branch point: BEFORE_PROCESSING
0.04: point of treatment: AFTER_SUBMIT
0.04:... Process 'PK get': PLSQL (AFTER_SUBMIT) declare function get_pk return varchar2 is begin C1 in (select ORACLE_SR_SEQ.nextval double next_val) loop return c1.next_val; end loop; end; Start: P50_ORACLE_SR_ID: = get_pk; end;
0.04:... * session state: saved point new value "P50_ORACLE_SR_ID" = "6."
0.04:... Treat "Line of ORACLE_SR process": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER #:ORACLE_SR:P50_ORACLE_SR_ID:ORACLE_SR_ID | IUD
0.04: see the error page...
0.04: execute rollback...
ORA-01400: cannot insert NULL into ('ABILITY'. "" "" ORACLE_SR '. "" TIMESTAMP")
Cannot process the row in the ORACLE_SR table.
Back by demand.
Any thoughts would be appreciated.
Thank you
Justin.If you have changed the Source Type of an element of database column to something else, so he cannot participate in the automated line choreography Fetch/automatic line processing (DML). You must leave the Type of Source, as it was and change the default value of the element fill when the ARF process retrieves a null value for the column.
Scott
-
How to deal with NULL values in regexp_substr?
DECLARE TYPE t_rec IS TABLE OF VARCHAR2(200); /* case 1 */ l_input varchar2(100) := '28/09/2009 00:00:00|AFRISB|FC|773|7|17|512|76|60|U|'; /* case 2 */ -- l_input VARCHAR2(100) := '06/10/2009 00:00:00|PDIERR|PS|999|0|1|0|0||U|'; l_bars PLS_INTEGER; l_fields PLS_INTEGER; l_rec t_rec := t_rec(); BEGIN l_bars := regexp_count(l_input, '\|', 1, 'i'); l_fields := l_bars + 1; FOR fld IN 1 .. l_fields LOOP l_rec.EXTEND(); l_rec(fld) := REGEXP_SUBSTR(l_input, '[^|]+', 1, fld); dbms_output.put_line('Fld ' || fld || ': ' || l_rec(fld)); END LOOP; END;
The above code is that I break a string of pipe delimited into individual elements.
Looking at the case 1 in the code, the output displays each field correctly. However in case 2, the 9th field is null (nothing between the two tubes) so the regexp_substr 19 online is assigning the 'U' in the box 10 as a field 9.
What should I do to get the line 19 to correctly assign a NULL value to field 9?
Information about the version of the database are:
BANNER --------------------------------------------------------------------------------
12 c Oracle database Release 12.1.0.1.0 - 64 bit Production PL/SQL Release 12.1.0.1.0 - Production CORE Production 12.1.0.1.0 AMT for 64-bit Windows: Version 12.1.0.1.0 - Production NLSRTL Version 12.1.0.1.0 - Production
Thank you
Steve
Hello
If you want to use regexes, so instead of
REGEXP_SUBSTR (l_input, "[^ |]") +', 1, fld);
use
REGEXP_SUBSTR (l_input
, '([^|] *)(\|| $)'
-P
fld
NULL
-P
);
. The 6th argument to REGEXP_SUBSTR is a new feature of Oracle 11.1. It's kind of a back reference. Normally, REGEXP_SUBSTR returns the substring that matches the pattern in the 2nd argument. If the 6th argument is 1, however, REGEXP_SUBSTR returns only the part of the pattern between the 1st on the left '(' et sa correspondance)."
-
display of the output cursor empty with null values
I have the below procedure of the State where he is shown the output to the client.
The requirement now is if the select statement does not return a value any with the input given then output parameter should see NULL values instead of no line at all.
One method is to get the number of the select query that is written in "open p_out for." And then write the condition as if count is 0 then null other show data.Could you please suggest me any other alternative to this.
Create or replace procedure test (p_empno in number , p_out out sys_refcursor) is begin open p_out for select e.ename, d.deptname, s.sal , p.addr , v.age from emp e ,dept d, sal s, padress p , age v where e.deptno = d.deptno and d.deptno = s.deptno s.sal_id = p.sal_id and p.id = v.id and e.empno = p_empno ; exception when others then open p_out for select null , null,null,null,null from dual; end test.
Thank you
Maybe NOT TESTED!
Select x.ename, x.deptname, x.sal, x.addr, x.age
of the double
left outer join
(select e.ename, d.deptname, s.sal, p.addr, v.age
from emp e,.
d Dept,
SAL s,
padress p,
v of the age
where e.deptno = d.deptno
and d.deptno = s.deptno
and s.sal_id = p.sal_id
and p.id = v.id
and e.empno = p_empno
) x
1 = 1
Concerning
Etbin
Select x.*
of the double
left outer join
(select *)
WCP
where ename = 'ETBIN.
) x
1 = 1
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO - - - - - - - - -
Add filter slot table form to show the lines with null values
Hello
I have a tabular presentation where we need to add a filter with two values (selection list) so that if one of the columns in a table (column1) is zero, then I need to display all records where column1 is null.
I was wondering how do I put this in the Source of tabular forms where condition. This filter has only two values,
All the
NULL for the error
So when the user selects all, then all the records in the table are shown
If the user selects 'Value Null in error', while the records where Column1 is null will be shown
For example
If the user selects, thencolumn1 column2 A B 1 C 3 D
all four files will show up. Else, only the first and the second will be returned.
Thank youHi, Ryan.
Try a static LOV like this
STATIC2:;,--- All ---;--- All ---
and a Where clause, like this
where column1 is null or :p1_filter like '%%'
Jeff
-
creating table of partition with null values
Hello
I have a table with 20 GB of data. I changed this table in the table to partition with partition of the range
the column with which I took for range (date), holding the values null
can I have a partition for null values?Hello
CREATE TABLE ICBS. KNET_STMT_EXTRACT_NEW_P
(
SRVC_TYPE VARCHAR2 (200 BYTE),
FILLER_1 VARCHAR2 (200 BYTE),
RTE_STAT VARCHAR2 (200 BYTE),
TRAN_DATE VARCHAR2 (200 BYTE),
TRAN_TIME VARCHAR2 (200 BYTE),
POST_DATE VARCHAR2 (200 BYTE),
DATE OF REC_INSERT_DT,
DATE OF PROCESSED_DATE,
KNET_RECON_RESSON VARCHAR2 (100 BYTE),
NEW_TRAN_DATE VARCHAR2 (10 BYTE),
REASON VARCHAR2 (200 BYTE)
REASON_IND NUMBER (5),
NODE_ID VARCHAR2 (8 BYTE),
PROGRAM_ID VARCHAR2 (8 BYTE),
USER_ID VARCHAR2 (8 BYTE),
TIME_STAMP DATE
)
ICBS TABLESPACE
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE)
64K INITIALS
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
DEFAULT USER_TABLES
)
LOGGING
PARTITION BY RANGE (REC_INSERT_DT)
(KNET_STMT_EXTRACT_NEW_P_DEC11 PARTITION VALUES LESS THAN (TO_DATE (' 2012-01-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN '))
LOGGING
NOCOMPRESS
ICBS TABLESPACE
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE)
INITIAL 1 M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
DEFAULT USER_TABLES
),
KNET_STMT_EXTRACT_NEW_P_JAN12 PARTITION VALUES LESS THAN (TO_DATE (' 2012-02-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN '))
LOGGING
NOCOMPRESS
ICBS TABLESPACE
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE)
INITIAL 1 M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
DEFAULT USER_TABLES
),
PARTITION KNET_STMT_EXTRACT_NEW_P_MVAL VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE TBL_MAXVALUE
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE)
INITIAL 1 M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
DEFAULT USER_TABLES
)
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING
ALLOW THE MOVEMENT OF THE LINE;Published by: hitgon on April 30, 2012 10:56
Published by: hitgon on April 30, 2012 10:58
Published by: hitgon on April 30, 2012 10:59
-
REGEXP_SUBSTR for the list delimited by commas with null values
Hello
I have a column that stores a list of values comma-delimited. Some of these values in the list may be null. I'm having some trouble trying to extract the values using the REGEXP_SUBSTR function when null values are present. Here are two things I've tried:SELECT REGEXP_SUBSTR (val, '[^,]*', 1, 1) pos1 ,REGEXP_SUBSTR (val, '[^,]*', 1, 2) pos2 ,REGEXP_SUBSTR (val, '[^,]*', 1, 3) pos3 ,REGEXP_SUBSTR (val, '[^,]*', 1, 4) pos4 ,REGEXP_SUBSTR (val, '[^,]*', 1, 5) pos5 FROM (SELECT 'AAA,BBB,,DDD,,FFF' val FROM dual); POS P POS P P --- - --- - - AAA BBB
As you can see that neither calls work correctly. Anyone know how to change the regular expression pattern to handle null values? I tried various other models but could not get anyone to work in all cases.SELECT REGEXP_SUBSTR (val, '[^,]+', 1, 1) pos1 ,REGEXP_SUBSTR (val, '[^,]+', 1, 2) pos2 ,REGEXP_SUBSTR (val, '[^,]+', 1, 3) pos3 ,REGEXP_SUBSTR (val, '[^,]+', 1, 4) pos4 ,REGEXP_SUBSTR (val, '[^,]+', 1, 5) pos5 FROM (SELECT 'AAA,BBB,,DDD,,FFF' val FROM dual); POS POS POS POS P --- --- --- --- - AAA BBB DDD FFF
Thank you
Martin
-----
http://www.ClariFit.com
http://www.TalkApex.comHi, Martin,.
That's what you want:
SELECT RTRIM (REGEXP_SUBSTR (val, '[^,]*,', 1, 1), ',') pos1 ,RTRIM (REGEXP_SUBSTR (val, '[^,]*,', 1, 2), ',') pos2 ,RTRIM (REGEXP_SUBSTR (val, '[^,]*,', 1, 3), ',') pos3 ,RTRIM (REGEXP_SUBSTR (val, '[^,]*,', 1, 4), ',') pos4 ,RTRIM (REGEXP_SUBSTR (val || ',' , '[^,]*,', 1, 5), ',') pos5 FROM (SELECT 'AAA,BBB,,DDD,,FFF' val FROM dual);
The query above works in Oracle 10 or 11, but in Oracle 11, you can also do it with only REGEXP_SUBSTR, without using RTRIM:
SELECT REGEXP_SUBSTR (val, '([^,]*),|$', 1, 1, NULL, 1) pos1 ,REGEXP_SUBSTR (val, '([^,]*),|$', 1, 2, NULL, 1) pos2 ,REGEXP_SUBSTR (val, '([^,]*),|$', 1, 3, NULL, 1) pos3 ,REGEXP_SUBSTR (val, '([^,]*),|$', 1, 4, NULL, 1) pos4 ,REGEXP_SUBSTR (val, '([^,]*),|$', 1, 5, NULL, 1) pos5 FROM (SELECT 'AAA,BBB,,DDD,,FFF' val FROM dual);
The problem with your first request was that he was looking for sub channels of 0 or more non-virgules. There was as a substring. consisting of 3 characters starting at position 1, he returned "AAA", as expected. Then there was an another substring, the 0 characters, starting at position 4, so it returned NULL. Then, there was a substring of 3 characters starting at position 5, so he returned 'BBB '.
The problem with your 2nd request was that he was looking for 1 or more non-virgules. 'DDD' is the 3rd this substring.
Published by: Frank Kulash, on February 16, 2012 11:36
Added Oracle 11 example -
SQL Loader with the line terminator
Dear friends,
I use Oracle 10 g R2.
Need to load some records to a text file to Oracle.
It's my control file:
and received the error:LOAD DATA INFILE 'D:\load\dat\FinNote.dat' BADFILE 'D:\load\bad\FinNote.bad' DISCARDFILE 'D:\load\dat\discard\FinNote.dsc' INSERT INTO TABLE FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( IDNo, RegDate date 'YYYY-MM-DD HH24:MI:SS', Col1, Remark, UserID, Status) {code} My text file has semicolon as a row delimiter and | as column delimiter. Now, how can I add the semicolon as row delimiter. Please guide me. I followed the method given in this site: http://www.exforsys.com/tutorials/oracle-10g/oracle-10g-sql-loader-input-data-and-datafiles.html *INFILE datafile_name ["str terminator_string"]* {code} LOAD DATA INFILE 'D:\load\dat\CRS_FinNote.dat' ";" BADFILE 'D:\load\bad\CRS_FinNote.bad' DISCARDFILE 'D:\load\dat\discard\CRS_FinNote.dsc' INSERT INTO TABLE CRS_FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( StudentNo, IDate date 'YYYY-MM-DD HH24:MI:SS', Topic, Remark, UserID, Status)
SQL * Loader-500: could not open the file (D:\load\dat\CRS_FinNote.dat)
SQL * Loader-555: unrecognized property treatment option
SQL * Loader-509: System error: the operation completed successfully.
SQL * Loader-2026: the charge was dropped because SQL Loader cannot continue.
SQL * Loader-513: cannot close the file (D:\load\dat\CRS_FinNote.dat)
SQL * Loader-559: Error closing file
SQL * Loader-509: System error: the storage control block address is invalid.
Thanks in advance.
Nith
Published by: user645399 on June 16, 2010 10:35And, if your CRS_FinNote.dat look like below (line/record delimited; then)
1245|2000-05-16|Oracle|The Best|AAA|Online; 294|2000-04-03|Dotnet|Best|BBB|Pending; 300|2010-03-28|C++|The Best|CCC|Offline;
Scott@ORCL > select utl_raw.cast_to_raw (';') under "hexadecimal;" double;
in hexadecimal
--------------------------------------------------------------------------------
3BThen I change user645399.ctl with below:
LOAD DATA INFILE 'd:\csv\CRS_FinNote.dat' "str X'3B'" BADFILE 'd:\csv\FinNote.bad' DISCARDFILE 'd:\csv\FinNote.dsc' INSERT INTO TABLE FinNote FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS ( IDNo, RegDate date 'YYYY-MM-DD HH24:MI:SS', Col1, Remark, UserID, Status)
The idea received a link from http://www.orafaq.com/forum/t/140062/0/.
C:\Documents and Settings\Girish Sharma>sqlldr scott/tiger@orcl control=d:\csv\user645399.ctl log=user645399.log Enter user-name: scott/tiger Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SCOTT@orcl> select * from finnote; IDNO REGDATE COL1 REMARK USERID STATUS ---------- -------------------- ---------- ---------- ---------- ---------- 1245 16-may-2000 00:00:00 Oracle The Best AAA Online 294 03-apr-2000 00:00:00 Dotnet Best BBB Pending 300 28-mar-2010 00:00:00 C++ The Best CCC Offline SCOTT@orcl>
HTH
Girish Sharma -
NPE for rows with null values in the table of the adv
I created the table adv, 2 columns, equipped with two text fields. Initially the col2 is empty,
say that the structure is as follows:
When the user clicks on apply button I want to update these values in the table.col1 col2 Hdr Question Answer row1 abc zxc row2 pdd null (user doesnt enter anything) row3 zxc lkj APPLYBUTTON
I don't know how to do that, but that's what I'm trying to do. Please guide me the right way if its wrong.
in LICS, I took the APPLYBUTTON action, got all lines of the object corresponding to the view, consulted with everyrow and I'm checking if there are values in the fields in the table, if the value zero, are simply print null. (we would not update on this line). . I could get o the part update, due to null pointer exception
I get on the row line null pointer exception [1].getAttribute("Answer") for row2, it prints the value of row1 however.
Here is the code I wrote:
Set of rows from the rowset = (RowSet) vo.getRowSet ();
Rank rank [] = vo.getAllRowsInRange ();
System.out.println ("row.length" + row.length);
for (int i = 0; i < row.length; i ++) {}
String question = row.getAttribute("Question").toString ();
String response = row [i].getAttribute("Answer").toString ();
If (question! = null & &!("".)) Equals (question. Trim()))
{
System.out.println ("Question line" + i + "-" + question);
}
on the other
{
System.out.println ("Question line" + i + "is null");
}
If (response! = null & &!("".)) Equals (Answer.Trim ()))
{
System.out.println ("Response line" + i + "-" + response);
}
on the other
{
System.out.println ("Response line" + i + "is null");
}
Why the NPE survey code, I'm checking for null value and you want to print the value null in the logfile... I can not to getAttribute() on the null field, why can not just give me null in the variable I'm assigning to?
You can guide me what approach to take, if it is not correct.
I must examine DataDictionary and collect data there?
Thanks in advance.Hello
handle the exception of null on these two statements like this pointer
String question = "";
String response = "";Try
{
question = row.getAttribute("Question").toString ();
}
catch (NullPointerException e)
{
question = "";
}Try
{
answer = row.getAttribute("Answer").toString ();
}
catch (NullPointerException e)
{
response = "";
}Si ( !("". Equals (question. Trim()))
{
System.out.println ("Question line" + i + "-" + question);
}
on the other
{
System.out.println ("Question line" + i + "is null");
}Si ( !("". Equals (Answer.Trim ()))
{
System.out.println ("Response line" + i + "-" + response);
}
on the other
{
System.out.println ("Response line" + i + "is null");
}Thank you
Gerard -
Is it possible under the ORDER BY clause to not have null values climb on top
Examples:
SQL code...
ORDER BY
BL / / DESC
~*~*~*~*~*~*~*~
RESULT
bl*
(null)
8675309
--------------------------------------
ORDER BY
BL CSA
RESULT
bl*
(null)
8675309
Any thoughts?Yes, you can
select * from emp order by comm NULLS LAST ; OR select * from emp order by comm NULLS FIRST;
SS
-
Dear all,
I am loading data for a German client and the files shipped contain numeric data with decimal comma. For example 123.5 instead of 123.5
I've been Googling like crazy on this one and there is a lot of chatter on the definition of NLS_LANG and/or NLS_NUMERIC_CHARACTERS, but none of this seems to work in the environment SQL Loader.
I guess I'll end up tinkering together something complicated with TO_NUMBER or another function, but I really can't believe SQL Loader isn't a simple switch to return semicolon.
Or I forgot something?
Advice would be a great help.
Kind regards
Alan SearleYou can use something like:
Load data
INFILE...
BadFile...
....
fields completed by...
(
...
col1 "translate (: col1, ','.')", ".
...
)Published by: SKU on January 28, 2009 04:41
-
SQL Loader with BCP datetime format
Hi, Im having trouble loading of data from sybase to oracle may. I already .dat for my lens. However, its datetime column has changed its formula and it is not accepted to oracle.
Please see below.
Source table
PUP_DATE
------------------
2014-10-01 10:34:07.613
PUP_DATE = datetime (sybase - source table)
target table for pup_date data type is TIMESTAMP
When my sybase database are imported via bcp on looked this way date format .dat file
.dat file
....
< EOFD > 1000017962 < EOFD > Oct1 2014 AM < EOFD > 10:34:07.613
...
bcp sql developer-generated command line
BCP dbname.dbo.table_name /directory/test.dat - c t '< EOFD >' - r '< EORD >' - Usa - Ppassword - Sservername
What can I do to keep its format which is accepted at oracle?
I tried to change the date and time stamp of mask in sqldeveloper migration options. also the mapping of datatime timestamp data type.
Thank you!
The following shows how to use TO_TIMESTAMP in your SQL * control file loader to load your test.dat file data in a column of timestamp into a target of Oracle table.
Scott@orcl12c > test.dat TYPE of HOST
1000017962 Oct1 2014 10:34:07.613 AM Scott@orcl12c > test.ctl TYPE of HOST
DOWNLOAD THE DATA
Test.dat INFILE
IN the purpose of the TABLE
FIELDS TERMINATED BY '
'. TRAILING NULLCOLS
(fill1 FILLER
fill2 FILLER
', pup_date ' TO_TIMESTAMP (: pup_date, ' MonDD YYYY hh.) (FF3AM') ')
Scott@orcl12c > CREATE TABLE target
2 (pup_date TIMESTAMP)
3.
Table created.
Scott@orcl12c > HOST SQLLDR scott/tiger CONTROL = test.ctl LOG = test.log
SQL * Loader: release 12.1.0.1.0 - Production on Wed Jan 7 12:05:18 2015
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Path used: classics
Commit the point reached - the number of logical records 1
TARGET table:
1 row loaded successfully.
Check the log file:
test.log
For more information on the charge.
Scott@orcl12c > SELECT * TARGET
2.
PUP_DATE
---------------------------------------------------------------------------
1ST OCTOBER 14 10.34.07.613000 AM
1 selected line.
Maybe you are looking for
-
Re: Problems with Satellite L755 LAN
Until recently I bought a Toshiba laptop and after going through a lot of trouble finding the right drivers, I tried to connect to the internet via a modem (a switch in fact), but it says * currently connected to: unidentified network / internet acce
-
Record event blocks LabVIEW if the event Type is not selected.
Hi I think that found a possible bug in LV2011 SP1. -Thread a property node of event Reg on the dynamic event record Terminal of a structure of event -Add a case to the event -Click on the dynamic event -LV accidents The source code included, try add
-
Primary WRT1900AC &; comments networks on the same Radio channel
Hi - Newbie here. The main network and the network of comments on my WRT1900AC occupy the same 2.4 GHz radio channel, regardless of the selection of a channel or using AUTOMATIC channel selection. I want to change this scenario so that the primary n
-
problem with favorites: deleting and moving of deposit; freezes
I can't delete the Favorites or moving files to the fovorites-it freezes and can not close either; need to do the Task Manager, please help!
-
HP laserjet M425dn MFP 400: white pages when using the copy flow tray
Our HP laserjet MFP M425dn of 400 printer suddenly started printing blank pages when I food pages in the sandbox of copy on top of the lid and go through the routine of copy 'optimize '. When I place the original on the glass, then select copy, copi