Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Macro Substitution Variables in Oracle SQL
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 DBAReceived on Fri Aug 25 2006 - 17:31:30 CDT