Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: print horizontal
I think this could be useful:
SQL> create table my_test_table2 (y number(2), x number(5));
Table created.
SQL> insert into my_test_table2 select 1, rownum from all_objects where rownum < 7;
6 rows created.
SQL> insert into my_test_table2 select 2, rownum from all_objects where rownum < 10;
9 rows created.
SQL> select * from my_test_table2;
Y X
---------- ----------
1 1 1 2 1 3 1 4 1 5 1 6 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9
15 rows selected.
SQL> column trans format a80
SQL> r
1 select y, max(sys_connect_by_path(x, ' | ')) trans
2 from (
3 select y, x, row_number() over (partition by y order by x) cur,
row_number() over (partition by y order by x) - 1 prev
4 from my_test_table2
5 )
6 connect by prior cur = prev and prior y = y
7 start with cur = 1
8* group by y
Y TRANS
1 | 1 | 2 | 3 | 4 | 5 | 6 2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
HTH
On 1/24/06, raja rao <raja4list_at_yahoo.com> wrote:
>
> HI Team,
>
> Can someone help me to print the below in horizontal.
>
> SQL> select * from v2h;
> X
> ----------
> 1
> 2
> 3
> 4
> 5
>
>
> I need the values tobe printed like this:
>
> 1 2 3 4 5
>
> can someone give me some clue on this without using pl/sql.
>
> Thanks in adv,
> Raj
>
> ------------------------------
> Yahoo! Autos<http://us.rd.yahoo.com/evt=38381/+ylc=X3oDMTEzcGlrdGY5BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDMWF1dG9z/*http://autos.yahoo.com/index.html+>.
> Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.
>
>
>
-- ------------------------------------------------ Enrique -- http://www.freelists.org/webpage/oracle-lReceived on Tue Jan 24 2006 - 05:15:02 CST
![]() |
![]() |