![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
My input data is csv file like this with '|' delimiter: 1|first 2|second 3|third 4|fourth 5|fifth I need to load this into temp table for validation purposes...so I did this: with T (ID) as ( values '1|first','2|second','3|third','4|fourth','5| fifth') select substr(ID, 1,locate('|', ID)-1) as FIRST_COLUMN, substr(ID, locate('|', ID)+1, length(ID)-locate('|', ID)) as SECOND_COLUMN from T Is there better approach? What is syntax for having more than one column in "with" clause, eg: with T (ID, DESC) as ( values '1','2','3','4','5') select ID, DESC from T -- where should I put DESC ('first','second','third','fourth','fifth') in "values" clause? |
#3
| |||
| |||
|
|
My input data is csv file like this with '|' delimiter: 1|first 2|second 3|third 4|fourth 5|fifth I need to load this into temp table for validation purposes...so I did this: with T (ID) as ( values '1|first','2|second','3|third','4|fourth','5| fifth') select substr(ID, 1,locate('|', ID)-1) as FIRST_COLUMN, substr(ID, locate('|', ID)+1, length(ID)-locate('|', ID)) as SECOND_COLUMN from T Is there better approach? |
![]() |
| Thread Tools | |
| Display Modes | |
| |