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

Home -> Community -> Usenet -> c.d.o.server -> Re: problem with accept statement in PL/SQL loops urgent please new message

Re: problem with accept statement in PL/SQL loops urgent please new message

From: Ron Reidy <rereidy_at_indra.com>
Date: Thu, 13 Mar 2003 20:27:46 -0700
Message-ID: <3E714C32.8020407@indra.com>


Accept is a SQL*Plus command and will not compile (AFAIK) in PL/SQL. Think Korn shell Perl, or some other scripting langauge.

Kumaril Bhatt wrote:
> Hi everybody,
> My name is Kumaril Bhatt and I know SQL*plus.This is a new message. I
> am also including the errors I encountered. The version of oracle Iam
> using is 9.02. I have made some changes to the loop. The help needed
> is urgent. Please bail me out. If I have to invoke PL/SQL from SQL,
> Please provide me with script. I also used execute immediate statement
> in the loop given below. But no fruitful results
>
> I am not that familiar with PL/SQL. I want use loops in PL/SQL with
> user interaction. So I tried using an accept statement in a PL/SQL
> loop. But I got errors. I dont know much about scripts. So if any one
> could provide me with a script, so that the loop below can be
> executed. The loop asks the user whether he wants to insert more rows.
> If he says 'y' new rows are inserted in the table
>
> DECLARE
> ans char(1) :='y';
> cid char(4);
> vid char(4);
> vname varchar(15);
>
> begin
>
> while(ans = 'y') loop
>
> accept cid prompt "Enter customer id : ";
> accept vid prompt "Enter video id : ";
> accept vname prompt "Enter videoname : ";
>
> insert hire
> values (cid,vid,vname);
>
> accept ans prompt "Any more y/n : ";
>
> end loop;
> end;
>
>
> SQL> @loop2.sql
> 24 /
> accept cid prompt "Enter customer id : ";
> *
> ERROR at line 11:
> ORA-06550: line 11, column 8:
> PLS-00103: Encountered the symbol "CID" when expecting one of the
> following:
> := . ( @ % ;
>
>
> Thank You very Much
> Kumaril
Received on Thu Mar 13 2003 - 21:27:46 CST

Original text of this message

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