0

Hi All,

I am working in Oracle10g and I have been trying to run the following query, and am getting an error:

Query:

SET VERIFY OFF

VARIABLE emp_salary NUMBER

ACCEPT empno PROMPT 'Please enter a valid employee number: '

SET AUTOPRINT ON

DECLARE
empno NUMBER(6):= &empno;
BEGIN
SELECT salary INTO :emp_salary FROM employees
WHERE employee_id = empno;
END;
/

Error:

empno NUMBER(6):= ;
                                     *
ERROR at line 2:
ORA-06550: line 2, column 19:
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> 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 specification>
<an alternatively-quoted S



EMP_SALARY
----------


SQL>

If the error shows up distorted...the asterisk is located under the semi-colon in the error...
Could anyone guide me accordingly?

4
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by maydhyam
0

Try using $$empno on the where clause.

Lemme know whether it fixes your problem ..

Hi All,

I am working in Oracle10g and I have been trying to run the following query, and am getting an error:

Query:

SET VERIFY OFF

VARIABLE emp_salary NUMBER

ACCEPT empno PROMPT 'Please enter a valid employee number: '

SET AUTOPRINT ON

DECLARE
empno NUMBER(6):= &empno;
BEGIN
SELECT salary INTO :emp_salary FROM employees
WHERE employee_id = empno;
END;
/

Error:

empno NUMBER(6):= ;
                                     *
ERROR at line 2:
ORA-06550: line 2, column 19:
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> 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 specification>
<an alternatively-quoted S



EMP_SALARY
----------


SQL>

If the error shows up distorted...the asterisk is located under the semi-colon in the error...
Could anyone guide me accordingly?

0

Hi djbabu,

I did try $$empno in the where clause, but it still showed the same error...

0

I'm no PL/SQL expert but have you tried a ; at the end of line 2?

VARIABLE emp_salary NUMBER;

Might help.

1

Oh ok, thanks for your help.

Votes + Comments
Finally for marking this thread as solved after a couple of years. :)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.