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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: ampersand problem

RE: ampersand problem

From: Amar Kumar Padhi <TS2017_at_emirates.com>
Date: Thu, 04 Oct 2001 02:27:09 -0700
Message-ID: <F001.003A1869.20011004010529@fatcity.com>

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: srinivasa_v_at_infy.com

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: ListGuru_at_fatcity.com (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: TS2017_at_emirates.com
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: ListGuru_at_fatcity.com (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). Received on Thu Oct 04 2001 - 04:27:09 CDT

Original text of this message

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