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?
Andriy M
23.3k6 gold badges60 silver badges104 bronze badges
asked Jun 19, 2016 at 23:08
1 Answer 1
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): '
answered Jun 20, 2016 at 0:15
lang-sql