View previous topic :: View next topic
|
Author |
Message |
muralithirumalaisamy Warnings : 1 New User
Joined: 13 Jun 2005 Posts: 12 Location: chennai
|
|
|
|
We would like to create a view on a table by concatenating the columns in the table as single column in the view.
Example:
Table T1 has the below structure:
Col1 CHAR (3) Col2 CHAR (4) Col3 CHAR (5) Col4 CHAR (3) Col5 CHAR (2)
We would like to create a view v1 on Table T1 whose structure is as follows:
Colx
where colx is defined as col1 ]] col2 ]] col3 ]] col4 ]] col5
in the Create View DDL statement.
So the columns in T1 are concatenated to form one column Colx in the view.
This view creation will work only if all columns in the Table T1 are defined as character datatype as given in the above example.
Is there a way to create a view by concatenating all columns from a Table, where the table structure looks as below:
Col1 CHAR (3) Col2 CHAR (4) Col3 CHAR (5) Col4 DECIMAL Col5 CHAR (2) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you can CAST non char datatypes to char and then concatenate them. |
|
Back to top |
|
|
muralithirumalaisamy Warnings : 1 New User
Joined: 13 Jun 2005 Posts: 12 Location: chennai
|
|
|
|
Can you just help me in writing that query which will do the concatination of columns... |
|
Back to top |
|
|
|