Awlad Liton
Awlad Liton

Reputation: 9351

Oracle Timestamp to sysdate conversion error

it gives error like this: date format picture ends before converting entire input string

declare
  v_t timestamp; 
begin
  v_t := to_timestamp(systimestamp,'DD/MM/YY')+interval '12-3' year to month;
  DBMS_OUTPUT.PUT_LINE(v_t);
end;

Upvotes: 1

Views: 609

Answers (1)

Justin Cave
Justin Cave

Reputation: 231671

SYSTIMESTAMP is already a timestamp so you do not want to call to_timestamp. If you want to add 12 years 3 months to the current timestamp

SQL> ed
Wrote file afiedt.buf

  1  declare
  2    v_t timestamp;
  3  begin
  4    v_t := systimestamp +interval '12-3' year to month;
  5    DBMS_OUTPUT.PUT_LINE(v_t);
  6* end;
SQL> /
20-JUL-24 03.27.28.966000 PM

PL/SQL procedure successfully completed.

Upvotes: 1

Related Questions