473,504 Members | 13,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INSERT Trouble

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

Jun 21 '07 #1
6 1904
cb*****@gmail.com wrote:
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 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
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 21 '07 #2
On Jun 21, 1:10 pm, Serge Rielau <srie...@ca.ibm.comwrote:
cber...@gmail.com wrote:
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 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

--
Serge Rielau
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

Jun 22 '07 #3
cb*****@gmail.com wrote:
On Jun 21, 1:10 pm, Serge Rielau <srie...@ca.ibm.comwrote:
>cber...@gmail.com wrote:
>>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 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

--
Serge Rielau
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
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....

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 22 '07 #4
On Jun 22, 1:24 pm, Serge Rielau <srie...@ca.ibm.comwrote:
cber...@gmail.com wrote:
On Jun 21, 1:10 pm, Serge Rielau <srie...@ca.ibm.comwrote:
cber...@gmail.com wrote:
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 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
--
Serge Rielau
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

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....

--
Serge Rielau
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... =:))

Jun 30 '07 #5
cb*****@gmail.com wrote:
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
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 30 '07 #6
On Jun 30, 2:33 pm, Serge Rielau <srie...@ca.ibm.comwrote:
cber...@gmail.com wrote:
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
--
Serge Rielau
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"

Jun 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
22184
by: DTB | last post by:
I am having trouble creating an INSTEAD OF trigger in SQL Server to replicate a BEFORE UPDATE trigger from ORACLE. Here is a sample of the ORACLE BEFORE UPDATE trigger: CREATE TRIGGER myTRIGGER ON...
14
36956
by: Andre | last post by:
Hello Can anyone help me translate this from access so that it can work in mssql (i need to get next value, but cannot use identity as if row is deleted, another must get new next column number...
2
3926
by: User | last post by:
Hi ! I have a sql insert function with a buttonin my page, and when i click on refresh button of IE. When i click my button, i have a new records but after when i click on the refresh button of IE...
7
20920
by: David Bear | last post by:
I have a dictionary that contains a row of data intended for a data base. The dictionary keys are the field names. The values are the values to be inserted. I am looking for a good pythonic...
3
6876
by: Jacob Lyles | last post by:
Howdy, I'm a but of a newbie and I'd appreciate some help with a MySQL issue I'm having. I'm trying to insert some data into MySQL from a POST form but the query breaks whenever a user fails to...
3
1815
by: rhaazy | last post by:
Using ms sql 2000 I have 2 tables. I have a table which has information regarding a computer scan. Each record in this table has a column called MAC which is the unique ID for each Scan. The...
5
4818
by: mabond | last post by:
Hi VB.NET 2005 Express edition Microsoft Access 2000 (SP-3) Having trouble writing an "insert into" command for a Microsoft table I'm accessing through oledb. I've tried to follow the same...
1
12037
by: Wes Groleau | last post by:
INSERT INTO X ...... ( A, B, C ) INSERT INTO Y ...... ( J, K, L ) If Y has a foreign key M which is the primary key D of X, is there an easy and/or efficient way to have SQL Server assign D,...
0
4434
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
1
2271
by: veasnamuch | last post by:
I have a problem while I create a trigger to my table. My objective is getting any change made to my table and record it in to another table . My have thousands records before I add new trigger to...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.