Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Posts
    12

    Unanswered: 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

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •