Home > Blockchain >  oracle sql not accepting the input from the user
oracle sql not accepting the input from the user

Time:10-04

Whenever i try to run a program consisting of user input the compiler always throws the same error of i dont know what that means. the error does not explain what the error is that i am encountering, can anyone please help regarding this problem. Here is the error:

Unsupported Command
Unsupported Command
ORA-06550: line 6, column 4:
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 

Here is the code for plsql in which i am taking user input for temperature and returning the celcius or farenheight temp of the same.

declare
f number;
n number;
ch char;
begin
f:=&f;
ch:=&ch;
if(ch!='F') then
n:=(f-32)*5/9;
else
n:=(f*9/5) 32;
end if;
dbms_output.put_line('Temperature: '||f||' '||ch);
end;
/

I would be highly grateful for your efforts. Thank you

CodePudding user response:

The & syntax indicates the variable is a substitution variable which is processed in the client application (it is effectively a find-replace on the variable).

Substitution variables are only supported by a limited number of client applications (including SQL*Plus and SQL Developer); they are not supported in other applications such as Oracle Apex, Java, C#, Python, etc.

You are getting the error because your client application does not support substitution variables; instead, you need to use the correct syntax for the application you are using (which may be to use bind variables).

  • Related