• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3647
  • Last Modified:

CREATING VIEWS HEADACHE

Hello,

I am tryigng to create views in IBM DB2, but I keep getting error msg;-

[IBM][CLI Driver][DB2/NT] SQL0153N  The statement does not
include a required column list.  SQLSTATE=42908

what exactly does this error mean, and I do I eliminate the cause.

Thank you

0
claracruz
Asked:
claracruz
  • 2
  • 2
  • 2
1 Solution
 
sathyagiriCommented:
SQL0153N The CREATE VIEW statement or
common table expression does not
include a column list.
Explanation: A column list must be specified in
a CREATE VIEW statement or a common table
expression when:
v any element of the SELECT list in the fullselect
is other than a column name and is not named
using the AS clause
v any two elements are the same column name
that were not renamed using the AS clause.
The statement cannot be processed. For a
CREATE VIEW statement, the view was not
created.
User Response: Provide a column name list in
the CREATE VIEW statement or common table
expression or name the columns in the SELECT
list of the fullselect using the AS clause.
sqlcode: -153
0
 
sathyagiriCommented:
Post your create view statement here
0
 
claracruzAuthor Commented:
CREATE VIEW VEHICLEDETAILSVIEW AS SELECT
V.VEHICLEID,
V.BARCODE,
V.DATECREATED,
V.DATEONSITE, V.DATELEFTSITE,
V.REGNUMBER,
V.NOKEEPERS,
V.MAKE,
V.MODEL,
V.DOORPLAN, V.TRANSMISSION,
V.FUELTYPE,
V.COLOUR,
V.ENGINESIZE,
V.DATEOFREGISTRATION, V.VIN,
V.METALLICPAINT,
V.MILEAGE,
V.MILEAGECORRECT,
V.VATABLEFLAG, V.WARRANTY,
V.LOGBOOK,
V.SERVICEHISTORYID,
V.SERVICEPRINTOUT,
V.COLLECTIONJOBID, V.DELIVERYJOBID,
V.VEHICLESTEREOID,
V.REDKEY,
V.TAX,
V.TAXEXPIRYDATE, V.COMMENTS,
V.VENDORCUSTOMERID,
V.VEHICLESTATUSID,
V.VEHICLELOCATIONID, V.VEHICLESITEID,
V.DISPLAYLOTNO,
V.SPARE1,
V.NONRUNNER,
V.ALLOYWHEELS, V.INTERNETLOTNO,
V.PLATETRANSFERFLAG,
V.CAPCODE,
V.CAPVALUERETAIL,
V.CAPVALUECLEAN, V.CAPVALUEAVERAGE,
V.CAPVALUEBELAVERAGE,
V.GLASS,
V.STANDINGVALUE,
V.CAPCONDITIONID, V.CREATETIME,
V.CREATEUSER,
V.UPDATETIME,
V.UPDATEUSER,
V.CAPVALUATIONDATE, V.CAPREGYEAR,
V.CAPREGLETTER,
V.CAPMILES,
V.CAPMAKE,
V.CAPMODEL, V.HPIMAKE,
V.HPIMODEL,
V.VEHICLETYPEID,
V.VEHICLEMOTID,
V.ELECTRICWINDOWSID, V.SATNAV,
V.STARTCODE,
V.LEATHERSEATS,
V.NUMBEROFSEATS,
V.SUNROOF, V.AIRCONDITIONING,
V.POWERSTEERING,
V.SIGNWRITTEN,
V.MOTEXPIRYDATE,
V.ONSITEFLAG, V.REGLETTER,
V.CAPVALUATIONMSG,
V.CAPVALUATIONTIME,
V.CHASSISNUMBER,
PMAUSER.VEHICLEELECTRICWINDOWS.VEHICLEELECTRICWINDOWSID,
PMAUSER.VEHICLEELECTRICWINDOWS.DESCRIPTION AS ELECTRICWINDOWS_DESCRIPTION,
PMAUSER.VEHICLELOGBOOK.VEHICLELOGBOOKID,
PMAUSER.VEHICLELOGBOOK.DESCRIPTION AS LOGBOOK_DESCRIPTION,
PMAUSER.VEHICLEMOT.VEHICLEMOTID,  
PMAUSER.VEHICLEMOT.DESCRIPTION AS MOT_DESCRIPTION,
PMAUSER.VEHICLESTEREO.VEHICLESTEREOID,
PMAUSER.VEHICLESTEREO.DESCRIPTION AS STEREO_DESCRIPTION,
PMAUSER.VEHICLETYPE.VEHICLETYPEID,
PMAUSER.VEHICLETYPE.DESCRIPTION AS VEHICLETYPE_DESCRIPTION,
PMAUSER.VEHICLESTATUSLIST.VEHICLESTATUSLISTID,
PMAUSER.VEHICLESTATUSLIST.DESCRIPTION AS VEHICLETYPE_DESCRIPTION,
PMAUSER.LOT.LOTID,
PMAUSER.LOT.AUCTIONSCHEDULEID,
PMAUSER.LOT.VEHICLEID,
PMAUSER.LOT.STATUSID,
PMAUSER.LOT.VEHICLEOUTINGREASONTYPEID,
PMAUSER.LOT.DATECREATED,
PMAUSER.LOT.DISPLAYLOTNO,
PMAUSER.LOT.DISPLAYRESERVEPRICE,
PMAUSER.LOT.HIGHESTBID,
PMAUSER.LOT.SALEPRICE,
PMAUSER.LOT.DATESOLD,
PMAUSER.LOT.PROVISIONALSALEFLAG,
PMAUSER.LOT.CAPCODE,
PMAUSER.LOT.RESERVEPRICE,
PMAUSER.LOT.CAPREGYEAR,
PMAUSER.LOT.CAPREGLETTER,
PMAUSER.LOT.CAPMILES,
PMAUSER.LOT.CAPVALUATIONDATE,
PMAUSER.LOT.CAPVALUERETAIL,
PMAUSER.LOT.CAPVALUECLEAN,
PMAUSER.LOT.CAPVALUEAVERAGE,
PMAUSER.LOT.CAPVALUEBELOWAVERAGE,
PMAUSER.LOT.CREATETIME,
PMAUSER.LOT.CREATEUSER,
PMAUSER.LOT.UPDATEUSER,
PMAUSER.LOT.UPDATETIME,
PMAUSER.LOT.SALEVATRATE,
PMAUSER.LOT.CAPVALUATIONMSG,
PMAUSER.LOT.CAPVALUATIONTIME,
PMAUSER.AUCTIONSCHEDULE.AUCTIONSCHEDULEID,
PMAUSER.AUCTIONSCHEDULE.SALELOCATIONID,
PMAUSER.AUCTIONSCHEDULE.SALETIME AS STARTTIME,
PMAUSER.AUCTIONSCHEDULE.ENDTIME AS ENDTIME,
PMAUSER.AUCTIONSCHEDULE.AUCTIONSCHEDULEREF,
PMAUSER.AUCTIONSCHEDULE.AUCTIONTYPEID
FROM PMAUSER.VEHICLE AS V
LEFT JOIN PMAUSER.VEHICLEELECTRICWINDOWS ON PMAUSER.VEHICLEELECTRICWINDOWS.VEHICLEELECTRICWINDOWSID =  V.ELECTRICWINDOWSID
LEFT JOIN PMAUSER.VEHICLELOGBOOK ON PMAUSER.VEHICLELOGBOOK.VEHICLELOGBOOKID =  V.LOGBOOK
LEFT JOIN PMAUSER.VEHICLEMOT ON PMAUSER.VEHICLEMOT.VEHICLEMOTID =  V.VEHICLEMOTID
LEFT JOIN PMAUSER.VEHICLESTEREO ON PMAUSER.VEHICLESTEREO.VEHICLESTEREOID =  V.VEHICLESTEREOID
LEFT JOIN PMAUSER.VEHICLETYPE ON PMAUSER.VEHICLETYPE.VEHICLETYPEID =  V.VEHICLETYPEID
LEFT JOIN PMAUSER.VEHICLESTATUSLIST ON PMAUSER.VEHICLESTATUSLIST.VEHICLESTATUSLISTID =  V.VEHICLESTATUSLISTID
LEFT JOIN PMAUSER.LOT ON PMAUSER.LOT.VEHICLEID =  V.VEHICLEID  
LEFT JOIN PMAUSER.AUCTIONSCHEDULE ON PMAUSER.AUCTIONSCHEDULE.AUCTIONSCHEDULEID = PMAUSER.LOT.AUCTIONSCHEDULEID
LEFT OUTER JOIN ZAGDB2AP.BIDS ON ZAGDB2AP.BIDS.VEHICLEID =  V.VEHICLEID
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
LowfatspreadCommented:
you have

PMAUSER.VEHICLETYPE.DESCRIPTION AS VEHICLETYPE_DESCRIPTION, <---
PMAUSER.VEHICLESTATUSLIST.VEHICLESTATUSLISTID,
PMAUSER.VEHICLESTATUSLIST.DESCRIPTION AS VEHICLETYPE_DESCRIPTION  <----
you may have other duplicates...

try...

CREATE VIEW VEHICLEDETAILSVIEW AS SELECT
V.VEHICLEID,
V.BARCODE,
V.DATECREATED,
V.DATEONSITE, V.DATELEFTSITE,
V.REGNUMBER,
V.NOKEEPERS,
V.MAKE,
V.MODEL,
V.DOORPLAN, V.TRANSMISSION,
V.FUELTYPE,
V.COLOUR,
V.ENGINESIZE,
V.DATEOFREGISTRATION, V.VIN,
V.METALLICPAINT,
V.MILEAGE,
V.MILEAGECORRECT,
V.VATABLEFLAG, V.WARRANTY,
V.LOGBOOK,
V.SERVICEHISTORYID,
V.SERVICEPRINTOUT,
V.COLLECTIONJOBID, V.DELIVERYJOBID,
V.VEHICLESTEREOID,
V.REDKEY,
V.TAX,
V.TAXEXPIRYDATE, V.COMMENTS,
V.VENDORCUSTOMERID,
V.VEHICLESTATUSID,
V.VEHICLELOCATIONID, V.VEHICLESITEID,
V.DISPLAYLOTNO,
V.SPARE1,
V.NONRUNNER,
V.ALLOYWHEELS, V.INTERNETLOTNO,
V.PLATETRANSFERFLAG,
V.CAPCODE,
V.CAPVALUERETAIL,
V.CAPVALUECLEAN, V.CAPVALUEAVERAGE,
V.CAPVALUEBELAVERAGE,
V.GLASS,
V.STANDINGVALUE,
V.CAPCONDITIONID, V.CREATETIME,
V.CREATEUSER,
V.UPDATETIME,
V.UPDATEUSER,
V.CAPVALUATIONDATE, V.CAPREGYEAR,
V.CAPREGLETTER,
V.CAPMILES,
V.CAPMAKE,
V.CAPMODEL, V.HPIMAKE,
V.HPIMODEL,
V.VEHICLETYPEID,
V.VEHICLEMOTID,
V.ELECTRICWINDOWSID, V.SATNAV,
V.STARTCODE,
V.LEATHERSEATS,
V.NUMBEROFSEATS,
V.SUNROOF, V.AIRCONDITIONING,
V.POWERSTEERING,
V.SIGNWRITTEN,
V.MOTEXPIRYDATE,
V.ONSITEFLAG, V.REGLETTER,
V.CAPVALUATIONMSG,
V.CAPVALUATIONTIME,
V.CHASSISNUMBER,
EW.VEHICLEELECTRICWINDOWSID,
EW.DESCRIPTION AS ELECTRICWINDOWS_DESCRIPTION,
LB.VEHICLELOGBOOKID,
LB.DESCRIPTION AS LOGBOOK_DESCRIPTION,
MOT.VEHICLEMOTID,  
MOT.DESCRIPTION AS MOT_DESCRIPTION,
S.VEHICLESTEREOID,
S.DESCRIPTION AS STEREO_DESCRIPTION,
VT.VEHICLETYPEID,
VT.DESCRIPTION AS VEHICLETYPE_DESCRIPTION,
VS.VEHICLESTATUSLISTID,
VS.DESCRIPTION AS VEHICLESTATUS_DESCRIPTION,
L.LOTID,
L.AUCTIONSCHEDULEID,
L.VEHICLEID,
L.STATUSID,
L.VEHICLEOUTINGREASONTYPEID,
L.DATECREATED,
L.DISPLAYLOTNO,
L.DISPLAYRESERVEPRICE,
L.HIGHESTBID,
L.SALEPRICE,
L.DATESOLD,
L.PROVISIONALSALEFLAG,
L.CAPCODE,
L.RESERVEPRICE,
L.CAPREGYEAR,
L.CAPREGLETTER,
L.CAPMILES,
L.CAPVALUATIONDATE,
L.CAPVALUERETAIL,
L.CAPVALUECLEAN,
L.CAPVALUEAVERAGE,
L.CAPVALUEBELOWAVERAGE,
L.CREATETIME,
L.CREATEUSER,
L.UPDATEUSER,
L.UPDATETIME,
L.SALEVATRATE,
L.CAPVALUATIONMSG,
L.CAPVALUATIONTIME,
A.AUCTIONSCHEDULEID,
A.SALELOCATIONID,
A.SALETIME AS STARTTIME,
A.ENDTIME AS ENDTIME,
A.AUCTIONSCHEDULEREF,
A.AUCTIONTYPEID
FROM PMAUSER.VEHICLE AS V
LEFT JOIN PMAUSER.VEHICLEELECTRICWINDOWS as EW
  ON EW.VEHICLEELECTRICWINDOWSID =  V.ELECTRICWINDOWSID
LEFT JOIN PMAUSER.VEHICLELOGBOOK as LB
  ON LB.VEHICLELOGBOOKID =  V.LOGBOOK
LEFT JOIN PMAUSER.VEHICLEMOT as MOT
  ON MOT.VEHICLEMOTID =  V.VEHICLEMOTID
LEFT JOIN PMAUSER.VEHICLESTEREO as S
  ON S.VEHICLESTEREOID =  V.VEHICLESTEREOID
LEFT JOIN PMAUSER.VEHICLETYPE as VT
  ON VT.VEHICLETYPEID =  V.VEHICLETYPEID
LEFT JOIN PMAUSER.VEHICLESTATUSLIST as VS
  ON VS.VEHICLESTATUSLISTID =  V.VEHICLESTATUSLISTID
LEFT JOIN PMAUSER.LOT as L
  ON L.VEHICLEID =  V.VEHICLEID  
LEFT JOIN PMAUSER.AUCTIONSCHEDULE as A
  ON A.AUCTIONSCHEDULEID = L.AUCTIONSCHEDULEID
LEFT OUTER JOIN ZAGDB2AP.BIDS
  ON ZAGDB2AP.BIDS.VEHICLEID =  V.VEHICLEID
0
 
claracruzAuthor Commented:
SAME ERROR, so is the error occuring because there may be duplication output names?
0
 
LowfatspreadCommented:
yes thats a good probably cause...

you've got an L and a V vehicleid...



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now