This content has been marked as final. Show 5 replies
Use the Accept statement.
I always use a prefix 'p_' for a parameter.
Accept p_distance prompt 'Please Enter the distance: '
select ref_site from t_comsis
where longitude_lamb + latitude_lamb < &p_distance + power(&p_distance,2).
&& works fine
select ref_site from t_comsis where longitude_lamb + latitude_lamb < &&distance + power(&&distance,2).
Yes, && does work, but the useability is limited.
If you want the script to be re-executed and prompted for a different value each time, you will need to use the ACCEPT statement.
of course accept is more friendly, you can check for valid number, you can have a prompt or a hidden input.
you can also undef your variable if you prefer the && solution
SQL> select &&x+&&x from dual; Enter value for x: 1 old 1: select &&x+&&x from dual new 1: select 1+1 from dual 1+1 ---------- 2 SQL> undef x SQL> r 1* select &&x+&&x from dual Enter value for x: 2 old 1: select &&x+&&x from dual new 1: select 2+2 from dual 2+2 ---------- 4