If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Issues in creating Views for DB2 UDB V8.1 fixpack 7

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-29-06, 05:02
maheshbs maheshbs is offline
Registered User
 
Join Date: Mar 2006
Posts: 12
Issues in creating Views for DB2 UDB V8.1 fixpack 7

Hi,

I receive the following error in DB2 when i try to create the following view:-

CREATE VIEW vwequipmentsparesparts(INTRECORDID,VCLEVELCODE,VCL EVELDESCRIPTION,INTREFERENCERECORDID,INTCURRENTLEV EL,INTLEVEL1,INTLEVEL2,INTLEVEL3,INTLEVEL4,INTLEVE L5,INTLEVEL6,INTLEVEL7,INTLEVEL8,VCITEMCODE,VCDESC RIPTION,VCUNITOFMEASURE,INTQUANTITYONHAND,INTQUANT ITYORDER)
AS SELECT TABMPLEVEL.INTRECORDID,
TABMPLEVEL.VCLEVELCODE,
TABMPLEVEL.VCLEVELDESCRIPTION,
TABMPLEVEL.INTREFERENCERECORDID,
TABMPLEVEL.INTCURRENTLEVEL,
TABMPLEVEL.INTLEVEL1,
TABMPLEVEL.INTLEVEL2,
TABMPLEVEL.INTLEVEL3,
TABMPLEVEL.INTLEVEL4,
TABMPLEVEL.INTLEVEL5,
TABMPLEVEL.INTLEVEL6,
TABMPLEVEL.INTLEVEL7,
TABMPLEVEL.INTLEVEL8,
TABMPEQUIPMENTITEM.VCITEMCODE,
syitem.VCDESCRIPTION,
syitem.VCUNITOFMEASURE,
syitem.INTQUANTITYONHAND,
syitem.INTQUANTITYORDER
FROM TABMPLEVEL,
TABMPEQUIPMENTITEM,
syitem
WHERE TABMPLEVEL.INTRECORDID = TABMPEQUIPMENTITEM.INTRECORDID
AND syitem.VCITEM = TABMPEQUIPMENTITEM.VCITEMCODE
UNION
SELECT TABMPLEVEL.INTRECORDID,
TABMPLEVEL.VCLEVELCODE,
TABMPLEVEL.VCLEVELDESCRIPTION,
TABMPLEVEL.INTREFERENCERECORDID,
TABMPLEVEL.INTCURRENTLEVEL,
TABMPLEVEL.INTLEVEL1,
TABMPLEVEL.INTLEVEL2,
TABMPLEVEL.INTLEVEL3,
TABMPLEVEL.INTLEVEL4,
TABMPLEVEL.INTLEVEL5,
TABMPLEVEL.INTLEVEL6,
TABMPLEVEL.INTLEVEL7,
TABMPLEVEL.INTLEVEL8,
cast(syitem.VCITEM as varchar(25)),
syitem.VCDESCRIPTION,
syitem.VCUNITOFMEASURE,
syitem.INTQUANTITYONHAND,
syitem.INTQUANTITYORDER
FROM TABMPLEVEL,
TABMPEQUIPMENTDRAWING,
syitem
WHERE TABMPLEVEL.INTRECORDID = TABMPEQUIPMENTDRAWING.INTRECORDID
AND cast(syitem.VCITEM as varchar(25)) LIKE COALESCE( cast (TABMPEQUIPMENTDRAWING.VCGROUPCODE as varchar(25)), '') || '%'

Error:-
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0132N A LIKE predicate or POSSTR scalar function is not valid because the
first operand is not a string expression or the second operand is not a
string. SQLSTATE=42824

Please provide the necessary solution to this view and the corrections in the command.Also provide me the inputs on the error.

Thanks in Advance,
Mahesh
__________________
Mahy
Reply With Quote
  #2 (permalink)  
Old 06-29-06, 08:13
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The second operand of a LIKE has to be a literal, special register, host variable, a scalar function whose operands are any of the above, or an expression concatenating any of the above.

Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On