943,772 Members | Top Members by Rank

Ad:
  • Oracle Discussion Thread
  • Marked Solved
  • Views: 6708
  • Oracle RSS
May 11th, 2009
0

Accept/Prompt

Expand Post »
Hi All,

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

Query:
sql Syntax (Toggle Plain Text)
  1. SET VERIFY OFF
  2.  
  3. VARIABLE emp_salary NUMBER
  4.  
  5. ACCEPT empno PROMPT 'Please enter a valid employee number: '
  6.  
  7. SET AUTOPRINT ON
  8.  
  9. DECLARE
  10. empno NUMBER(6):= &empno;
  11. BEGIN
  12. SELECT salary INTO :emp_salary FROM employees
  13. WHERE employee_id = empno;
  14. END;
  15. /

Error:
sql Syntax (Toggle Plain Text)
  1. empno NUMBER(6):= ;
  2. *
  3. ERROR at line 2:
  4. ORA-06550: line 2, COLUMN 19:
  5. PLS-00103: Encountered the symbol ";" WHEN expecting one of the following:
  6. ( - + CASE MOD new NOT NULL <an identifier>
  7. <a double-quoted delimited-identifier> <a bind variable> avg
  8. count current EXISTS max min prior sql stddev sum variance
  9. execute forall merge TIME TIMESTAMP INTERVAL DATE
  10. <a string literal with character SET specification>
  11. <a number> <a single-quoted SQL string> pipe
  12. <an alternatively-quoted string literal with character SET specification>
  13. <an alternatively-quoted S
  14.  
  15.  
  16.  
  17. EMP_SALARY
  18. ----------
  19.  
  20.  
  21. SQL>

If the error shows up distorted...the asterisk is located under the semi-colon in the error...
Could anyone guide me accordingly?
Similar Threads
Reputation Points: 48
Solved Threads: 1
Posting Pro
maydhyam is offline Offline
555 posts
since Feb 2008
May 13th, 2009
0

Re: Accept/Prompt

Try using $$empno on the where clause.

Lemme know whether it fixes your problem ..


Click to Expand / Collapse  Quote originally posted by maydhyam ...
Hi All,

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

Query:
sql Syntax (Toggle Plain Text)
  1. SET VERIFY OFF
  2.  
  3. VARIABLE emp_salary NUMBER
  4.  
  5. ACCEPT empno PROMPT 'Please enter a valid employee number: '
  6.  
  7. SET AUTOPRINT ON
  8.  
  9. DECLARE
  10. empno NUMBER(6):= &empno;
  11. BEGIN
  12. SELECT salary INTO :emp_salary FROM employees
  13. WHERE employee_id = empno;
  14. END;
  15. /

Error:
sql Syntax (Toggle Plain Text)
  1. empno NUMBER(6):= ;
  2. *
  3. ERROR at line 2:
  4. ORA-06550: line 2, COLUMN 19:
  5. PLS-00103: Encountered the symbol ";" WHEN expecting one of the following:
  6. ( - + CASE MOD new NOT NULL <an identifier>
  7. <a double-quoted delimited-identifier> <a bind variable> avg
  8. count current EXISTS max min prior sql stddev sum variance
  9. execute forall merge TIME TIMESTAMP INTERVAL DATE
  10. <a string literal with character SET specification>
  11. <a number> <a single-quoted SQL string> pipe
  12. <an alternatively-quoted string literal with character SET specification>
  13. <an alternatively-quoted S
  14.  
  15.  
  16.  
  17. EMP_SALARY
  18. ----------
  19.  
  20.  
  21. SQL>

If the error shows up distorted...the asterisk is located under the semi-colon in the error...
Could anyone guide me accordingly?
Reputation Points: 10
Solved Threads: 1
Newbie Poster
djbabu is offline Offline
1 posts
since May 2009
May 14th, 2009
0

Re: Accept/Prompt

Hi djbabu,

I did try $$empno in the where clause, but it still showed the same error...
Reputation Points: 48
Solved Threads: 1
Posting Pro
maydhyam is offline Offline
555 posts
since Feb 2008
Jun 8th, 2009
0

Re: Accept/Prompt

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

VARIABLE emp_salary NUMBER;

Might help.
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
alit2002 is offline Offline
52 posts
since Dec 2006
Jun 10th, 2009
0

Re: Accept/Prompt

I did, and that brings about an error...
Reputation Points: 48
Solved Threads: 1
Posting Pro
maydhyam is offline Offline
555 posts
since Feb 2008
Mar 2nd, 2011
0
Re: Accept/Prompt
we cannot pass bind variables in interval area
Reputation Points: 10
Solved Threads: 1
Newbie Poster
gajanan123 is offline Offline
1 posts
since Mar 2011
Mar 23rd, 2011
1
Re: Accept/Prompt
Oh ok, thanks for your help.
Reputation Points: 48
Solved Threads: 1
Posting Pro
maydhyam is offline Offline
555 posts
since Feb 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Oracle Forum Timeline: Help Me... Normalization HW ..... plz plz
Next Thread in Oracle Forum Timeline: Softwate for creating SAS datasets from Oracle





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC