EE instance DB2 v7.2.0 fixpack 3 on WIN2K.
I select some data from a table A and write it to a file using the COALESCE
function and whitespace as the null character:
eg coalesce(col1, ' '). This column has 10,000 nulls in table A.
Select count(*) from table A where col1 is null=10,000
Using the load utlity, I load the data file as follows into table B which
has not null constraint on col1:
LOAD FROM LOAD.TEST OF ASC
MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20
METHOD L (1 11)
ROWCOUNT 2000000
MESSAGES LOAD.REPORT
REPLACE INTO TABLE2
FOR EXCEPTION TABLEX2
STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL
The load only generates 9,954 exceptions. Would like to understand why.
Thank you 6 4113
"JS" <fy***@hotmail.com> wrote in message
news:e9**************************@posting.google.c om... EE instance DB2 v7.2.0 fixpack 3 on WIN2K. I select some data from a table A and write it to a file using the
COALESCE function and whitespace as the null character: eg coalesce(col1, ' '). This column has 10,000 nulls in table A. Select count(*) from table A where col1 is null=10,000 Using the load utlity, I load the data file as follows into table B which has not null constraint on col1: LOAD FROM LOAD.TEST OF ASC MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20 METHOD L (1 11) ROWCOUNT 2000000 MESSAGES LOAD.REPORT REPLACE INTO TABLE2 FOR EXCEPTION TABLEX2 STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL The load only generates 9,954 exceptions. Would like to understand why.
I'm not clear on what you're trying to do, mostly because you haven't fully
described tables A and B, specifically what columns are in each and how
those columns are defined.
It *sounds* like you're saying that you are only selecting one column, col1,
from Table A and are trying to load it into a Table B which also has only 1
column. Is that right? If so, what is the difference between Table A and
Table B in the first place; if they are the same table, why copy from one to
another?
Also, this: Select count(*) from table A where col1 is null=10,000
is definitely going to be a problem. The expression count(*) is going to
return a single number, the number of rows in Table A that satisfy the where
clause. The where clause doesn't make sense though: do you want the rows
where col1 is null or the rows where col1 = 10000? I suspect you really want
to copy over *all* of the rows, (not the NUMBER of rows), so that you don't
want that count(*) expression at all and you don't want the where clause
either. But I'm really not sure.
I don't understand this remark at all: The load only generates 9,954 exceptions. Would like to understand why.
By saying "only", it sounds like you are complaining because you wanted
*more* exceptions. Most people would be trying to find out how to get the
number of exceptions down to 0 to show that all of their data got
transferred over successfully.
Again, I'm really not sure what you're trying to do. Perhaps if you could
explain that in a bit more detail, someone could help you accomplish that.
Rhino
"Rhino" <rh****@NOSPAM.sympatico.ca> wrote in message news:<gL*********************@news20.bellglobal.co m>... "JS" <fy***@hotmail.com> wrote in message news:e9**************************@posting.google.c om... EE instance DB2 v7.2.0 fixpack 3 on WIN2K. I select some data from a table A and write it to a file using the COALESCE function and whitespace as the null character: eg coalesce(col1, ' '). This column has 10,000 nulls in table A. Select count(*) from table A where col1 is null=10,000 Using the load utlity, I load the data file as follows into table B which has not null constraint on col1: LOAD FROM LOAD.TEST OF ASC MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20 METHOD L (1 11) ROWCOUNT 2000000 MESSAGES LOAD.REPORT REPLACE INTO TABLE2 FOR EXCEPTION TABLEX2 STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL The load only generates 9,954 exceptions. Would like to understand why.
I'm not clear on what you're trying to do, mostly because you haven't fully described tables A and B, specifically what columns are in each and how those columns are defined.
It *sounds* like you're saying that you are only selecting one column, col1, from Table A and are trying to load it into a Table B which also has only 1 column. Is that right? If so, what is the difference between Table A and Table B in the first place; if they are the same table, why copy from one to another?
Also, this: Select count(*) from table A where col1 is null=10,000 is definitely going to be a problem. The expression count(*) is going to return a single number, the number of rows in Table A that satisfy the where clause. The where clause doesn't make sense though: do you want the rows where col1 is null or the rows where col1 = 10000? I suspect you really want to copy over *all* of the rows, (not the NUMBER of rows), so that you don't want that count(*) expression at all and you don't want the where clause either. But I'm really not sure.
I don't understand this remark at all: The load only generates 9,954 exceptions. Would like to understand why. By saying "only", it sounds like you are complaining because you wanted *more* exceptions. Most people would be trying to find out how to get the number of exceptions down to 0 to show that all of their data got transferred over successfully.
Again, I'm really not sure what you're trying to do. Perhaps if you could explain that in a bit more detail, someone could help you accomplish that.
Rhino
Perhaps badly explained, load command should have read:
LOAD FROM LOAD.TEST OF ASC
MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20
METHOD L (1 11) >>>>>>>NULL INDICATORS (0)<<<<<<<<<<<<<<<<
ROWCOUNT 2000000
MESSAGES LOAD.REPORT
REPLACE INTO TABLE2
FOR EXCEPTION TABLEX2
STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL
Select count(*) from table A where col1 is null
Result=10,000
This means the result of the sql statement is 10,000, that is 10,000
rows in table A have null values for col1
Doesnt matter what the difference is between the two columns as long
as the two tables have the same structure, the point is once the load
is completed, I should get 10,000 exceptions in the exception table,
instead I get only 9,954.
"JS" <fy***@hotmail.com> wrote in message
news:e9**************************@posting.google.c om... "Rhino" <rh****@NOSPAM.sympatico.ca> wrote in message
news:<gL*********************@news20.bellglobal.co m>... "JS" <fy***@hotmail.com> wrote in message news:e9**************************@posting.google.c om... EE instance DB2 v7.2.0 fixpack 3 on WIN2K. I select some data from a table A and write it to a file using the COALESCE function and whitespace as the null character: eg coalesce(col1, ' '). This column has 10,000 nulls in table A. Select count(*) from table A where col1 is null=10,000 Using the load utlity, I load the data file as follows into table B
which has not null constraint on col1: LOAD FROM LOAD.TEST OF ASC MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20 METHOD L (1 11) ROWCOUNT 2000000 MESSAGES LOAD.REPORT REPLACE INTO TABLE2 FOR EXCEPTION TABLEX2 STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL The load only generates 9,954 exceptions. Would like to understand
why. I'm not clear on what you're trying to do, mostly because you haven't
fully described tables A and B, specifically what columns are in each and how those columns are defined.
It *sounds* like you're saying that you are only selecting one column,
col1, from Table A and are trying to load it into a Table B which also has
only 1 column. Is that right? If so, what is the difference between Table A and Table B in the first place; if they are the same table, why copy from
one to another?
Also, this: Select count(*) from table A where col1 is null=10,000 is definitely going to be a problem. The expression count(*) is going to return a single number, the number of rows in Table A that satisfy the
where clause. The where clause doesn't make sense though: do you want the rows where col1 is null or the rows where col1 = 10000? I suspect you really
want to copy over *all* of the rows, (not the NUMBER of rows), so that you
don't want that count(*) expression at all and you don't want the where clause either. But I'm really not sure.
I don't understand this remark at all: The load only generates 9,954 exceptions. Would like to understand
why. By saying "only", it sounds like you are complaining because you wanted *more* exceptions. Most people would be trying to find out how to get
the number of exceptions down to 0 to show that all of their data got transferred over successfully.
Again, I'm really not sure what you're trying to do. Perhaps if you
could explain that in a bit more detail, someone could help you accomplish
that. Rhino
Perhaps badly explained, load command should have read: LOAD FROM LOAD.TEST OF ASC MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20 METHOD L (1 11)>>>>>>>>NULL INDICATORS (0)<<<<<<<<<<<<<<<<
ROWCOUNT 2000000 MESSAGES LOAD.REPORT REPLACE INTO TABLE2 FOR EXCEPTION TABLEX2 STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL
Select count(*) from table A where col1 is null Result=10,000 This means the result of the sql statement is 10,000, that is 10,000 rows in table A have null values for col1
Okay, I get this part now.
Doesnt matter what the difference is between the two columns as long as the two tables have the same structure, the point is once the load is completed, I should get 10,000 exceptions in the exception table, instead I get only 9,954.
Well, perhaps it shouldn't matter, in theory, how the tables look but it's
easier to debug a problem if you understand what the other guy is doing. If
you want to tie our hands behind our backs, it may hurt the quality of the
answer you get ;-)
Frankly, I'm still scratching my head because what you're describing doesn't
seem to add up. On one hand, I'm getting the impression that LOAD.TEST
contains 10,000 lines/rows, each containing a single blank. (I'm assuming
that col1 is a char/varchar column because all the arguments in the COALESCE
function need to be the same class of data, e.g. character, numeric, etc.
The second argument is a char so the first must also be. The result of
coalesce(null, '') is ''.) The LOAD statement says you are only reading one
column from LOAD.TEST. But this doesn't make a lot of sense to me since you
need a key to tell LOAD which row of Table B it is being replaced by each
row of LOAD.TEST. (If all of the values in LOAD.TEST are blank, they are
obviously not primary key values.) You are also telling the LOAD statement
that you have 2 million rows, not 10,000.
If you can clarify that, maybe I can suggest a solution to your problem. If
not, maybe someone else can make sense of what you're trying to do.
Rhino
LOAD FROM LOAD.TEST OF ASC
MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20
METHOD L (1 11)
NULL INDICATORS (0)
ROWCOUNT 2000000
MESSAGES LOAD.REPORT
REPLACE INTO TABLE2
FOR EXCEPTION TABLEX2
STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL
Ok, its like this:
TABLE A has 10,000,000 rows, I only want to load the first 2,000,000.
Among these 2 million rows, 10,000 of them have space
(NULLINDCHAR=X20) or null values.
If the column value is less than varchar(20), I want the load to strip
the
blanks when replacing in TABLE B.
NULL INDICATORS (0) means that the col1 in TABLE B cannot accept null
values, therefore the load utility should reject any row that has null
as it value.
The original question still remains:
Why does the load utility reject less than 10,000 rows?
"JS" <fy***@hotmail.com> wrote in message
news:e9**************************@posting.google.c om... LOAD FROM LOAD.TEST OF ASC MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20 METHOD L (1 11) NULL INDICATORS (0) ROWCOUNT 2000000 MESSAGES LOAD.REPORT REPLACE INTO TABLE2 FOR EXCEPTION TABLEX2 STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL
Ok, its like this: TABLE A has 10,000,000 rows, I only want to load the first 2,000,000. Among these 2 million rows, 10,000 of them have space (NULLINDCHAR=X20) or null values. If the column value is less than varchar(20), I want the load to strip the blanks when replacing in TABLE B. NULL INDICATORS (0) means that the col1 in TABLE B cannot accept null values, therefore the load utility should reject any row that has null as it value. The original question still remains: Why does the load utility reject less than 10,000 rows?
Okay, that helps - somewhat. If I understand you, you really only want to
load the 1,990,000 rows (2 million minus 10,000) that don't have a blank in
columns 1-11 of LOAD.TEST but you are actually loading 1,990,046 records and
want to know why your technique is failing to exclude those extra 46
records.
It seems very likely that those extra 46 rows actually have values that you
aren't expecting. As an experiment, put only the 10,000 rows in LOAD.TEST
and see if they all get excluded or if some of them slip through. If some
slip through, read LOAD.TEST in a hex editor and see if you can find any
values that aren't what you're expecting. I expect that the values in Table
A aren't quite what you think they are and therefore the values in LOAD.TEST
aren't quite what you're expecting either.
If all 10,000 records get excluded, I'm not sure what to suggest but you've
probably eliminated the possibility that LOAD has a bug....
Rhino
"Rhino" <rh****@NOSPAM.sympatico.ca> wrote in message news:<J%*******************@news20.bellglobal.com> ... "JS" <fy***@hotmail.com> wrote in message news:e9**************************@posting.google.c om... LOAD FROM LOAD.TEST OF ASC MODIFIED BY STRIPTBLANKS NULLINDCHAR=X20 METHOD L (1 11) NULL INDICATORS (0) ROWCOUNT 2000000 MESSAGES LOAD.REPORT REPLACE INTO TABLE2 FOR EXCEPTION TABLEX2 STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL
Ok, its like this: TABLE A has 10,000,000 rows, I only want to load the first 2,000,000. Among these 2 million rows, 10,000 of them have space (NULLINDCHAR=X20) or null values. If the column value is less than varchar(20), I want the load to strip the blanks when replacing in TABLE B. NULL INDICATORS (0) means that the col1 in TABLE B cannot accept null values, therefore the load utility should reject any row that has null as it value. The original question still remains: Why does the load utility reject less than 10,000 rows?
Okay, that helps - somewhat. If I understand you, you really only want to load the 1,990,000 rows (2 million minus 10,000) that don't have a blank in columns 1-11 of LOAD.TEST but you are actually loading 1,990,046 records and want to know why your technique is failing to exclude those extra 46 records.
It seems very likely that those extra 46 rows actually have values that you aren't expecting. As an experiment, put only the 10,000 rows in LOAD.TEST and see if they all get excluded or if some of them slip through. If some slip through, read LOAD.TEST in a hex editor and see if you can find any values that aren't what you're expecting. I expect that the values in Table A aren't quite what you think they are and therefore the values in LOAD.TEST aren't quite what you're expecting either.
If all 10,000 records get excluded, I'm not sure what to suggest but you've probably eliminated the possibility that LOAD has a bug....
Rhino
NULL INDICATORS (0)
changed it to NULL INDICATORS (1), now it works, thanks anyways, still
Im at a loss to explain why it should work this way This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Donald Tyler |
last post by:
Then the only way you can do it that I can think of is to write a PHP script
to do basically what PHPMyAdmin is trying to do but without the LOCAL in
there.
However to do that you would need to...
|
by: R. Clausen |
last post by:
During the night we replicate multiple tables from a production
database to a test database. Due to a server disk space full
condition occurring while replication was running, a tablespace was...
|
by: Arti Potnis |
last post by:
Hi,
I am trying to execute the DB2 load utility from a C program.
lPid = fork();
execl(csExePath, csExeName,csCmd, NULL);
the contents of the parameter variables are as follows:-
|
by: DB_2 |
last post by:
Hello,
I was trying to load a comma-separated text file to a DB2 table. I
believe I have the syntax rigt for the LOAD command.
My first question is, how do you actually run it? It is not a...
|
by: claus.hirth |
last post by:
When I execute the following statment using the Command Center it
works:
LOAD CLIENT FROM 'Y:\\TheFixedWidthData.txt' OF ASC METHOD L ( 1 1,2
11,12 17) REPLACE INTO S00.TheTargetTable...
|
by: nsh |
last post by:
mailing.database.mysql, comp.lang.php
subject: does "LOAD DATA" EVER work?!? I've tried EVERYTHING!
version info:
my isp is running my web page on a linux box with php ver. 4.4.1
according to...
|
by: huyuhui |
last post by:
The following is a question of LOAD utility.
Question:
How does the DB2 enforce table check constraints for data added to
table with the LOAD utility?
A. With the BUILD phase of LOAD
B. With the...
|
by: Justin |
last post by:
We had a load that failed. Now we have a pending load.
When executing load terminate, we receive the following error:
db2 load terminate
SQL0104N An unexpected token "terminate" was found...
|
by: mike.lopiano |
last post by:
There is a significant gap (~ 3.5 minutes) in the time our LOAD
command indicates that the BUILD phase is complete and the time we
have control returned to our script.
I ran the test below on a...
|
by: danfan46 |
last post by:
Hi.
I'm on DB2 9.5.0.1 on Linux AMD 64 and the database has four
partitions
where catalog is on partion 0 and user data on 1 thru 3.
After a load failure (path to load file was wrong) I...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
| |