This is not feasible within a PL/SQL block. Oracle will first prompt you to
input value for all the & provided in the code, before actually executing
it.
One option:
accept chk prompt 'Do you want to continue (y/n)?'
declare
  l_chk varchar2(1) :='&chk';
begin
  if l_chk = 'y' then
    dbms_output.put_line('user accepted to continue');
  else
    dbms_output.put_line('user cancelled operation');
  end if;
end;
/


rgds
amar



-----Original Message-----
Sent: Thursday, October 04, 2001 11:20 AM
To: Multiple recipients of list ORACLE-L


Hi Gurus,

declare
    v_empno number:=&empno;
    v_sal number:=&sal;
    ok1 varchar(1);
begin
    dbms_output.put_line('Do you want to update the sal...(Y/N)');
        if (upper('&ok1') = 'Y') then
            update emp set sal=v_sal where empno=v_empno;
        end if;
end;

In the above code if i want to get the 'Do you want to update the
sal...(Y/N)' before the variable ok1 what should i do..
my requirement is that i will take the empno and sal first and prompt
for updating.if i enter 'Y' then i will update the sal..
else i dont.but according to the above code i am begin asked to enter
empno,sal and variable ok1 at the first instance..
pl help me about this issue...
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Vijaya Chander V.S
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Amar Kumar Padhi
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to