Tuesday, 15 February 2011

sql - Create view with Union give error in IBM i -



sql - Create view with Union give error in IBM i -

hi trying add together 1 table info create needed info set. doing union via greenish screen strsql. gives error message: column list required' in cpyf add, don't have anything, whne legnths , attibutes of each fields same. here not sure do.

create view astccdta.eoddetails select lintot, odord#, odseq#, odlstc, odordd, odordt, odprlc, odprt#, odshp#, odntu$, odrqsd astccdta.eoddetaila union select lintot, ouord#, ouseq#, oulstc, ouordd, ouordt, ouprlc, ouprt#, oushp#, ountu$, ourqsd astccdta.eoddetailh

the first thing seek add together column lists:

create view astccdta.eoddetails(lintot, odord#, odseq#, odlstc, odordd, odordt, odprlc, odprt#, odshp#, odntu$, odrqsd) select lintot, odord#, odseq#, odlstc, odordd, odordt, odprlc, odprt#, odshp#, odntu$, odrqsd astccdta.eoddetaila union select lintot, ouord#, ouseq#, oulstc, ouordd, ouordt, ouprlc, ouprt#, oushp#, ountu$, ourqsd astccdta.eoddetailh ;

perhaps required strsql.

db2 accepts views without explicit column names.

edit:

you may able this:

create view astccdta.eoddetails select lintot, odord#, odseq#, odlstc, odordd, odordt, odprlc, odprt#, odshp#, odntu$, odrqsd astccdta.eoddetaila union select lintot, ouord# odord#, ouseq# odseq#, oulstc odlstc, ouordd odordd, ouordt odordt, ouprlc odprlc, ouprt# odprt#, oushp# odshp#, ountu$ odntu$, ourqsd odrqsd astccdta.eoddetailh ;

sql ibm-midrange db2400

No comments:

Post a Comment