0
votes
hello i am trying to read something from the keyboard using the "&". like this:
 declare
x number;
begin
x := &enter_value;
dbms_output.put_line(x*2);
end;
/

i am getting this error:

ORA-06550: line 4, column 6: PLS-00103: Encountered the symbol "&" when expecting one of the following:

   ( - + case mod new not null <an identifier>
   <a double-quoted delimited-identifier> <a bind variable>
   continue avg count current exists max min prior sql stddev
   sum variance execute forall merge time timestamp interval
   date <a string literal with character set specification>
   <a number> <a single-quoted SQL string> pipe
   <an alternatively-quoted string literal with character set specifi


2. x number;
3. begin
4. x := &enter_value;
5. dbms_output.put_line(x*2);
6. end;

i am using the online apex: apex.oracle.com

1
Are you using the Application Builder or the SQL Workshop in Oracle Apex?Ro Milton
i am using the sql wokshopmariusxd
The & is not part of the PL/SQL syntax, it usually is used to supply a substitution string (e.g. you might use &ITEMNAME. in an Apex application or in a SQL*Plus script). I don't think the SQL Workshop recognises it.Jeffrey Kemp

1 Answers

0
votes

The bind variable syntax depends on the app that you're using. The ampersand syntax you're trying to use (&enter_value) is associated with SQL Developer, not SQL Workshop.

If you copy and paste your code into SQL Developer, it should work. (Note: sometimes you have to wrap it in quotes eg '&enter_value').

I don't know of any way to use substitution strings in SQL Workshop.