1

I am defining a variable in "userdata.sql",its contents are

SET DEFINE ON;
DEFINE name = Gaurav
DEFINE today =10/10/2011 --variable that contain date value.

==================================================================================

I am creating another file called xyz.sql

@userdata.sql
DECLARE 
v_date DATE;
v_name varchar2(10);
BEGIN
v_date:='&today';
v_name:='&name';
dbms_output.put_line('name is '||v_name);
dbms_output.put_line('date is '||v_date);
end;

On execution of xyz.sql its throwing an error ora-01840 input value not long enough for date format. Please suggest the solution to it. The RDBMS i am using is ORACLE

1 Answer 1

2

Change this line:

v_date:='&today';

to:

v_date:=to_date('&today','DD/MM/YYYY');

i.e. specify the date format (it could be 'MM/DD/YYYY' instead).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.