Conditional Union ?
From: General Fear <richmarin_at_earthlink.net>
Date: Thu, 19 Jun 2008 21:32:37 -0700 (PDT)
Message-ID: <43074073-48a6-48df-91c9-2a8703f28b3d@26g2000hsk.googlegroups.com>
Date: Thu, 19 Jun 2008 21:32:37 -0700 (PDT)
Message-ID: <43074073-48a6-48df-91c9-2a8703f28b3d@26g2000hsk.googlegroups.com>
I am using 10g.
Below is a crude example of what I am trying to do
Procedure
( pi_input as interger
)
is
Cursor A
is
Select 'A' as Letter from Dual;
Cursor B
is
Select 'A' as Letter from Dual;
Union
Select 'B' as Letter from Dual;
If pi_input = 1 then
Open A
Else
Open B
End If
Notice that Select 'A' as Letter from Dual is in two cursors. If I have to make a change to Cursor A, I also have to do it again in cursor B because "Select 'A' as Letter from Dual' is in two cursors.
Is it possible to eliminate repeat code in the above example? What do I need to do. Received on Thu Jun 19 2008 - 23:32:37 CDT