Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: can I do this in SQL??
In article <7umovi$t98$1_at_diana.bcn.ttd.net>,
"Jorge" <pumuky22_at_usa.net> wrote:
> Hi everyone, I'm trying to do this select ....
> I have two tables (user_indexes and user_ind_columns) and I want this
> output:
>
> index1 column1 column2 column3
> by row
>
> thanks
>
>
I don't know if you can do it in a single SQL statement, but howabout this?
declare
v_columns varchar2(2000);
begin
for x in (select index_name
from user_indexes where table_name = 'MYTABLE') loopv_columns := x.index_name;
from user_ind_columns where index_name = x.index_name) loop v_columns := v_columns || ' ' || y.column_name;end loop;
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Oct 22 1999 - 12:25:37 CDT