By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,851 Members | 1,729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,851 IT Pros & Developers. It's quick & easy.

Problem When Creating Views

P: n/a
hi,
The Query to Create View is:
CREATE VIEW PROJECT_vw AS \
SELECT \
PROJNO \
,PROJNAME \
,DEPTNO \
,RESPEMP \
,PRSTAFF \
,CHAR(SUBSTR(monthname(PRSTDATE),1,3))||'
'||RTRIM(CHAR(day(PRSTDATE)))||' '||LTRIM(RTRIM(CHAR(year(PRSTDATE))))
\
,CHAR(SUBSTR(monthname(PRENDATE),1,3))||'
'||RTRIM(CHAR(day(PRENDATE)))||' '||LTRIM(RTRIM(CHAR(year(PRENDATE))))
\
,MAJPROJ \
FROM PROJECT

But it gives the following 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:
SQL0153N The statement does not include a required column list.
SQLSTATE=42908

What is wrong with the query? May be its giving problem with the
concatenation part but i want the data into the views to be like that
only. What is the correct query to do this?

Help will be appreciated
TIA

Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Following columns have no name.
,CHAR(SUBSTR(monthname(PRSTDATE),1,3))||'
'||RTRIM(CHAR(day(PRSTDATE)))||' '||LTRIM(RTRIM(CHAR(year(PRSTDATE))))
\
,CHAR(SUBSTR(monthname(PRENDATE),1,3))||'
'||RTRIM(CHAR(day(PRENDATE)))||' '||LTRIM(RTRIM(CHAR(year(PRENDATE))))
\

Add column list.
CREATE VIEW PROJECT_vw(PROJNO, PROJNAME, DEPTNO, RESPEMP,
PRSTAFF,PRSTDATE, RENDATE) AS \

Nov 12 '05 #2

P: n/a
Sorry, I forgot MAJPROJ.
CREATE VIEW PROJECT_vw(PROJNO, PROJNAME, DEPTNO, RESPEMP,
PRSTAFF,PRSTDATE, RENDATE, MAJPROJ) AS \

Nov 12 '05 #3

P: n/a
It worked. Thanx for the reply.

Nov 12 '05 #4

P: n/a
Tonkuma wrote:
Following columns have no name.
,CHAR(SUBSTR(monthname(PRSTDATE),1,3))||'
'||RTRIM(CHAR(day(PRSTDATE)))||' '||LTRIM(RTRIM(CHAR(year(PRSTDATE))))
\
,CHAR(SUBSTR(monthname(PRENDATE),1,3))||'
'||RTRIM(CHAR(day(PRENDATE)))||' '||LTRIM(RTRIM(CHAR(year(PRENDATE))))
\

Add column list.
CREATE VIEW PROJECT_vw(PROJNO, PROJNAME, DEPTNO, RESPEMP,
PRSTAFF,PRSTDATE, RENDATE) AS \


Or give the columns an explicit name in the select list:

SELECT col1, col2, col3 + col4 AS myName
FROM ...

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.