|
View previous topic :: View next topic
|
| Author |
Message |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2624 Location: Silicon Valley
|
|
|
|
Right now, I am not using the INCLUDE clause and it more or less works. But on some instances of the name, I get a -433:
| Code: |
| DSNT408I SQLCODE = -433, ERROR: VALUE TBOC7001_BASE IS TOO LONG |
For that reason, I think I need to have an INCLUDE clause which will let me specify a data type of VARCHAR(128).
But I am not having luck with the correct syntax. Does anyone have an example of a SQL MERGE statement with the INCLUDE clause? |
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2624 Location: Silicon Valley
|
|
|
|
I finally read the manual.
| Quote: |
INCLUDE can only be specified when the
MERGE statement is nested in the FROM clause of a SELECT statement. |
But how do I resolve my -433 problem? The NAME column is VARCHAR(128)
| Code: |
MERGE INTO PEDRO.TABLE1 AS A
USING (
VALUES ( 168 ,'TB','QUOC7001','TBOC7001_BASE','' ,'' )) AS B
(SCOPEID,TYPE,QUALIFIER ,NAME , COLNAME,AUTHLEVEL)
ON A.SCOPEID = B.SCOPEID
AND A.TYPE = B.TYPE
AND A.QUALIFIER = B.QUALIFIER
AND A.NAME = B.NAME
WHEN NOT MATCHED
THEN
INSERT( SCOPEID, TYPE, QUALIFIER, NAME, COLNAME, AUTHLEVEL)
VALUES
(B.SCOPEID, B.TYPE, B.QUALIFIER, B.NAME, B.COLNAME, B.AUTHLEVEL) |
|
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
Pedro,
can you INSERT a row into PEDRO.TABLE1 with
VALUES ( 168 ,'TB','QUOC7001','TBOC7001_BASE','' ,'' ) |
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2624 Location: Silicon Valley
|
|
|
|
Found my problem... apparently the SQL parser wants a blank after a comma.
When all of the values are strung together, it causes some unpredictable results.
| Code: |
| VALUES ( 168 ,'TB','QUOC7001','TBOC7001_BASE','' ,'' )) AS B |
Well, I could not predict it before. Maybe in the future. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|