Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Macro Substitution Variables in Oracle SQL

Re: Macro Substitution Variables in Oracle SQL

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sat, 26 Aug 2006 00:31:30 +0200
Message-ID: <vbuue2hh2jvafe577m762s5up608cl1gt2@4ax.com>


On 25 Aug 2006 08:03:14 -0700, "Andreww" <andrew.whittam_at_gmail.com> wrote:

>Hi Sybrand - I am a bit confused...
>
>if I had the following code:
>
>select count(*)
>from tblCustomers
>where store_code='X189';
>
>How would I implement the solution?
>
>Thanks for your help.
>
>Andrew

define p_store_code = '&1'
select count(*)
from tblCustomers
where store_code = '&p_store_code'

or

variable p_store_code varchar2(4);
begin
:p_store_code := '&1';
end;
/
select count(*)
from tblcustomers
where store_code = :p_store_code

in both cases you would call the script with <script name> <space> 'X189'

If you don't provide the parameter you will be prompted.

Could you please refrain from top posting?

--
Sybrand Bakker, Senior Oracle DBA
Received on Fri Aug 25 2006 - 17:31:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US