Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to append query in oracle pl/sql?

SeshuGiriFeb 4 2008 — edited Feb 6 2008

HI,

How to append following child parts to main sql (select statement)?

   PROCEDURE DisplayEmpPect (
      input_Type     IN       VARCHAR2,
      resultset      OUT      cur_ga
   )
   IS
   BEGIN
      OPEN resultset FOR

	If input_Type = "A" Then
         SELECT SUM (E.Salary) AS Sal
           FROM HEMP E
	ELSE If input_Type = "B" Then
	    WHERE E.EMP = 'ALL'
	ELSE
	    WHERE E.EMP = 'ALL'
		AND E.Type = 'Cont'
	END IF
   END;

Note: The query that I gave in procedure is not actual query, actual query is very big and has many conditions in it. I just need an idea
to append query parts to main select based on conditions.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 5 2008
Added on Feb 4 2008
7 comments
6,279 views