How to correct text form SQL Prompt in anonymous block
How to correct text form SQL Prompt in anonymous block
Example: In below PL/SQL block i've user invalid identifier "timestamp"
SQL> declare
v_date timestamp;
begin
select timestamp - 1/24 into v_date from dual;
dbms_output.put_line('one hour ago: '||v_date);
end;
/ 2 3 4 5 6 7
select timestamp - 1/24 into v_date from dual;
*
ERROR at line 4:
ORA-06550: line 4, column 8:
PL/SQL: ORA-00904: "TIMESTAMP": invalid identifier
ORA-06550: line 4, column 1:
PL/SQL: SQL Statement ignored
SQL> c /timestamp/systimestamp -- correcting spelling.
4* select systimestamp - 1/24 into v_date from dual;
# Again we've executed, now its working
SQL> /
one hour ago: 26-NOV-14 05.50.37.000000 PM
PL/SQL procedure successfully completed.
SQL>
SQL>
Example: In below PL/SQL block i've user invalid identifier "timestamp"
SQL> declare
v_date timestamp;
begin
select timestamp - 1/24 into v_date from dual;
dbms_output.put_line('one hour ago: '||v_date);
end;
/ 2 3 4 5 6 7
select timestamp - 1/24 into v_date from dual;
*
ERROR at line 4:
ORA-06550: line 4, column 8:
PL/SQL: ORA-00904: "TIMESTAMP": invalid identifier
ORA-06550: line 4, column 1:
PL/SQL: SQL Statement ignored
SQL> c /timestamp/systimestamp -- correcting spelling.
4* select systimestamp - 1/24 into v_date from dual;
# Again we've executed, now its working
SQL> /
one hour ago: 26-NOV-14 05.50.37.000000 PM
PL/SQL procedure successfully completed.
SQL>
SQL>

Comments
Post a Comment