|
-
Hi suresh,
sql> select * from test;
COL1 COL2 COL3 COL4
---------- ---------- ---------- ----------
a1 a2 a3 a4
b1 b2 b3 b4
c1 c2 c3 c4
d1 d2 d3 d4
a.sql
*****
declare
cursor a is select * from user_tab_columns where table_name='TEST';
cursor b is select * from test;
aa varchar2(5000);
begin
for i in a loop
aa:=aa||i.column_name;
for ii in b loop
if i.column_id=1 then
aa:=aa||' | ' || ii.col1;
elsif i.column_id=2 then
aa:=aa||' | ' || ii.col2;
elsif i.column_id=3 then
aa:=aa||' | ' || ii.col3;
elsif i.column_id=4 then
aa:=aa||' | ' || ii.col4;
end if;
end loop;
dbms_output.put_line(aa);
aa:=' ';
end loop;
end;
sql>@a
COL1 | a1 | b1 | c1 | d1
COL2 | a2 | b2 | c2 | d2
COL3 | a3 | b3 | c3 | d3
COL4 | a4 | b4 | c4 | d4
PL/SQL procedure successfully completed.
Seelan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|