On the move:

I'm currently moving the following to their own blogs: Unix, HTML for Blogs, Perl & Java.
The links are on the left side.

Tuesday, September 16, 2008

PL/SQL Loop Creates Pivot

Declare
All_Depts Varchar2 (50) := '';

Cursor c_Loc Is
-----------------------------------
-- don't put ',' in front of 1st
-----------------------------------
Select Case When Rownum <> 1 Then ',' End
||
Loc
As
Loc
From Dept;

Begin
For c_Each In c_Loc
Loop
All_Depts := All_Depts || c_Each.Loc;
End Loop;

Dbms_Output.Put_Line (All_Depts);
End;
/

1 comment: