Home » SQL & PL/SQL » SQL & PL/SQL » 2 ACCEPT Commands
2 ACCEPT Commands [message #36826] Mon, 24 December 2001 14:49 Go to next message
j.smith
Messages: 21
Registered: December 2001
Junior Member
2 ACCEPT Commands in a script below:

ACCEPT lowdate DATE FORMAT ('MM/DD/YYYY') PROMPT 'Please enter the low date range (MM/DD/YYYY) :'
ACCEPT highdate DATE FORMAT ('MM/DD/YYYY') PROMPT 'Please enter the high date range (MM/DD/YYYY) :'
SELECT ename || ', ' || job EMPLOYEES, hiredate
FROM emp
WHERE hiredate BETWEEN TO_DATE('&lowdate', 'MM/DD/YYYY') AND TO_DATE('&highdate', 'MM/DD/YYYY');
/

Result:

Please enter the low date range (MM/DD/YYYY) :01/01/1981
Please enter the high date range (MM/DD/YYYY) :01/01/1982

Please enter the low date range (MM/DD/YYYY) :01/01/1981
Please enter the high date range (MM/DD/YYYY) :01/01/1982

EMPLOYEES HIREDATE
--------------------- ---------
KING, PRESIDENT 17-NOV-81
BLAKE, MANAGER 01-MAY-81
CLARK, MANAGER 09-JUN-81
JONES, MANAGER 02-APR-81
MARTIN, SALESMAN 28-SEP-81
ALLEN, SALESMAN 20-FEB-81
TURNER, SALESMAN 08-SEP-81
JAMES, CLERK 03-DEC-81
WARD, SALESMAN 22-FEB-81
FORD, ANALYST 03-DEC-81

10 rows selected.

Input truncated to 1 characters

EMPLOYEES HIREDATE
--------------------- ---------
KING, PRESIDENT 17-NOV-81
BLAKE, MANAGER 01-MAY-81
CLARK, MANAGER 09-JUN-81
JONES, MANAGER 02-APR-81
MARTIN, SALESMAN 28-SEP-81
ALLEN, SALESMAN 20-FEB-81
TURNER, SALESMAN 08-SEP-81
JAMES, CLERK 03-DEC-81
WARD, SALESMAN 22-FEB-81
FORD, ANALYST 03-DEC-81

10 rows selected.

Im not sure why it displayed the same table twice.
.
So why does it do that?
Why not run through it once?
Any way to surpress it displaying twice?
Why is it truncated to 1 character?

----------------------------------------------------------------------
Re: 2 ACCEPT Commands [message #36828 is a reply to message #36826] Mon, 24 December 2001 15:20 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
use ';' or /

remove / from script file.

----------------------------------------------------------------------
Previous Topic: DDL trigger
Next Topic: Re: PL/SQL tables
Goto Forum:
  


Current Time: Mon Aug 03 05:07:58 CDT 2020