1

I want to ask in SQL script for a start and finish date with accept but I get an error.

accept v_FechaInicio date format 'DD/MM/YYYY-HH24:MI:SS' prompt 'Fecha de inicio ('DD/MM/YYYY-HH24:MI:SS'): '
accept v_FechaFin date    format 'DD/MM/YYYY-HH24:MI:SS' prompt 'Fecha de fin    ('DD/MM/YYYY-HH24:MI:SS'):'

SQL> SQL> SQL> SP2-0003: Ill-formed ACCEPT command starting as DD/MM/YYYY-HH24:MI:SS'): '
SQL> SP2-0003: Ill-formed ACCEPT command starting as DD/MM/YYYY-HH24:MI:SS'):'
SQL> accept v_FechaInicio date format 'DD/MM/YYYY-HH24:MI:SS' prompt 'Fecha de inicio ('DD/MM/YYYY-HH24:MI:SS'): '
SP2-0003: Ill-formed ACCEPT command starting as DD/MM/YYYY-HH24:MI:SS'): '

What is the problem?

1 Answer 1

2

It looks like your ACCEPT prompt includes quotation marks. But quotation marks are also used to delimit the prompt string, so if you want to include those characters into the prompt, you need to double them:

… prompt 'Fecha de inicio (''DD/MM/YYYY-HH24:MI:SS''): '
… prompt 'Fecha de fin    (''DD/MM/YYYY-HH24:MI:SS''):'

Although I think you could simply omit them, since this is just a prompt:

… prompt 'Fecha de inicio (DD/MM/YYYY-HH24:MI:SS): '
… prompt 'Fecha de fin    (DD/MM/YYYY-HH24:MI:SS): '

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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