Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / June 2007

Tip: Looking for answers? Try searching our database.

INSERT Trouble

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cberthu@gmail.com - 21 Jun 2007 05:54 GMT
Hi all,

I have a strange (at least for me) things happening. I am save the
result of an outer join into a file and I read this file and put these
values into a table.
The first row written contains the code page... how comes did I do
something wrong or is it a normal behavior?
I have to say that I did not manage to insert the value directly from
outer join....... I am not a DB2 Specialist.

Thanks for your help
Serge Rielau - 21 Jun 2007 12:10 GMT
> Hi all,
>
[quoted text clipped - 3 lines]
> The first row written contains the code page... how comes did I do
> something wrong or is it a normal behavior?
I have no clue what "row contains the codepage" means in this context
Taking a wild guess you may want to consider the modifiers on EXPRT/LOAD
that suppress code-page conversion.

> I have to say that I did not manage to insert the value directly from
> outer join....... I am not a DB2 Specialist.
INSERT INTO T SELECT * FROM S LEFT OUTER JOIN V WHERE S.C1 = V.C1

Cheers
Serge

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

cberthu@gmail.com - 22 Jun 2007 09:47 GMT
> cber...@gmail.com wrote:
> > Hi all,
[quoted text clipped - 21 lines]
> DB2 Solutions Development
> IBM Toronto Lab

Thanks Serge so let me explain...

I run this sql:
SELECT DISTINCT  TSOUNAME, TSOPRGNAME FROM D1.TCEOQRYALLHPUGRP LEFT
OUTER JOIN
D1.TCEODATAUSTSO ON (TSOUNAME = QRYALLGRPHPUUS)

THEY ARE 2336 ROWS IN TCEODATAUSTSO  AND 168332 ROWS IN
TCEOQRYALLHPUGRP SO I WANT TO SAVE THE RESULT INTO A NEW TABLE
TCEOHPUU (EXTRACT FROM A REXX) COL1 AND COL2 CONTAINS TSOUNAME
TSOPRGNAME

  STATEMENT ="INSERT INTO D1.TCEOHPUU VALUES ('"COL1"','"COL2"')
     INTERPRET SQQ "EXECUTE
IMMEDIATE :STATEMENT"
      IF (SQLCA.SQLCODE <> '0') & (SQLCA.SQLCODE <> '-803')
THEN
      CALL SQLCA "INPUTMETAHPU: INSERT STEP
FAILED"
     INTERPRET FURZ
"COMMIT"

AND THAN I GET THIS RESULT

COL1           COL2
1208        1208   <-------------------- First row (when DB code page
UFT-8)
1252            1252   <-------------------- First row (when DB code
page Latin)

I LITTLE CLEARER NOW... ?

THANKS FOR YOUR HELP
Serge Rielau - 22 Jun 2007 12:24 GMT
>> cber...@gmail.com wrote:
>>> Hi all,
[quoted text clipped - 52 lines]
>
> THANKS FOR YOUR HELP

Not a bit. But that may be because I don't know REXX.
I would look at the variable binding. For some reason you are extracting
the codepage instead of the values.
The issue very likely on the select (cursor) side and not the INSERT.
Now, why you are using a cursor with single row inserts it beyond me...

Cheers
Serge

PS: In general in the net using CAPS is considered shouting. This group
is fairy mellow w.r.t. netiquette, others are not....

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

cberthu@gmail.com - 30 Jun 2007 07:55 GMT
> cber...@gmail.com wrote:
> >> cber...@gmail.com wrote:
[quoted text clipped - 70 lines]
> DB2 Solutions Development
> IBM Toronto Lab

oK any serge Thanks for your help... I finally got it, I had first to
go over my code and try to simplify it...
This simply happened because when there were no rows to fetch (sqlcode
100) it put the codepage instead... any way it is fixed.

BTW could it be possible to put these two sql in one??
I mean conjugate the Select and inset in one statement... I am not a
SQL guru and this is a bit to advance for me... =:))
Serge Rielau - 30 Jun 2007 13:33 GMT
> BTW could it be possible to put these two sql in one??
> I mean conjugate the Select and inset in one statement... I am not a
> SQL guru and this is a bit to advance for me... =:))

INSERT INTO D1.TCEOHPUU
  SELECT DISTINCT  TSOUNAME, TSOPRGNAME
    FROM D1.TCEOQRYALLHPUGRP LEFT OUTER JOIN D1.TCEODATAUSTSO
      ON (TSOUNAME = QRYALLGRPHPUUS)

Cheers
Serge
Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

cberthu@gmail.com - 30 Jun 2007 14:44 GMT
> cber...@gmail.com wrote:
> > BTW could it be possible to put these two sql in one??
[quoted text clipped - 12 lines]
> DB2 Solutions Development
> IBM Toronto Lab

thank you... I just got out from my laziness and try it too....

"INSERT INTO "SCHEM1".TCEOHPUU (USRT, SRDESC) ",
"SELECT DISTINCT TSOUNAME, TSOPRGNAME FROM ",
SCHEM1".TCEODATAUSTSO, "SCHEM1".TCEOQRYALLHPUGRP ",
"WHERE TSOUNAME = QRYALLGRPHPUUS"
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.