Variable selects in PL/SQL

From: Dennis de Visser <dennisv_at_bart.nl>
Date: 1997/09/08
Message-ID: <5v1l7d$hfs_at_nosy.bart.nl>#1/1


[Quoted] Dear ORACLE users,

[Quoted] Can some one help me to create a variable select statement in PL/SQL.

I'm looking for a way to get the same result as the example ( SQL*Plus ), so it can be used in Forms.

COLUMN where1 NEW_VALUE where1 NOPRINT

SELECT DECODE('&1','%' ,NULL

                  ,'EAST','AND dept IN (''10'',''20'')'

                  ,'WEST','AND dept IN (''30'',''40'')'

                         ,NULL)       where1

FROM DUAL
;

SELECT ename

FROM emp

WHERE mng IS NOT NULL &where1

ORDER BY ename

;

I hope some of you got the answer.

Kind regards,

Dennis de Visser,
ORACLE programmer
Syntegra Netherlands
dennisv_at_bart.nl Received on Mon Sep 08 1997 - 00:00:00 CEST

Original text of this message