0

May I know what's the problem with this? I keep on getting this "SP2-0003 Ill formed" on the timestamp. How can I solve this?

ACCEPT v_cheindatetime timestamp FORMAT 'DD-MON-YY HH:MI:SS'
  PROMPT 'Enter Checkin Date & Time : '
ACCEPT v_cheoutdatetime timestamp FORMAT 'DD-MON-YY HH:MI:SS'
  PROMPT 'Enter Checkout Date & Time : '

--execute the INSERT statement
INSERT INTO booking VALUES
('&v_cheindatetime','&v_cheoutdatetime');
1
  • 1
    What values are you entering? – Mat Aug 7 '16 at 6:40
1

timestamp is not a valid type when using ACCEPT. Use date.

SQL*Plus® User's Guide and Reference - ACCEPT

SQL> !cat 1.sql
ACCEPT v_cheindatetime date FORMAT 'DD-MON-YY HH:MI:SS' PROMPT 'Enter Checkin Date and Time : '
ACCEPT v_cheoutdatetime date FORMAT 'DD-MON-YY HH:MI:SS' PROMPT 'Enter Checkout Date and Time : '

--execute the INSERT statement
INSERT INTO booking VALUES
('&v_cheindatetime','&v_cheoutdatetime');

SQL> @1
Enter Checkin Date and Time : 06-AUG-16 12:00:00
Enter Checkout Date and Time : 07-AUG-16 12:00:00
old   2: ('&v_cheindatetime','&v_cheoutdatetime')
new   2: ('06-AUG-16 12:00:00','07-AUG-16 12:00:00')

1 row created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.