Accept/Prompt

Reply

Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Accept/Prompt

 
0
  #1
May 11th, 2009
Hi All,

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

Query:
  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:
  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?
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 1
Reputation: djbabu is an unknown quantity at this point 
Solved Threads: 0
djbabu djbabu is offline Offline
Newbie Poster

Re: Accept/Prompt

 
0
  #2
May 13th, 2009
Try using $$empno on the where clause.

Lemme know whether it fixes your problem ..


Originally Posted by maydhyam View Post
Hi All,

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

Query:
  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:
  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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Re: Accept/Prompt

 
0
  #3
May 14th, 2009
Hi djbabu,

I did try $$empno in the where clause, but it still showed the same error...
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 44
Reputation: alit2002 is an unknown quantity at this point 
Solved Threads: 1
alit2002 alit2002 is offline Offline
Light Poster

Re: Accept/Prompt

 
0
  #4
Jun 8th, 2009
I'm no PL/SQL expert but have you tried a ; at the end of line 2?

VARIABLE emp_salary NUMBER;

Might help.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 478
Reputation: maydhyam is an unknown quantity at this point 
Solved Threads: 1
maydhyam's Avatar
maydhyam maydhyam is offline Offline
Posting Pro in Training

Re: Accept/Prompt

 
0
  #5
Jun 10th, 2009
I did, and that brings about an error...
The man who in view of gain thinks of righteousness; who in the view of danger is prepared to give up his life; and who does not forget an old agreement however far back it extends - such a man may be reckoned a complete man.
~ Confucius, The Confucian Analects
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC