How to get previous day in oracle pl/sql or "simply how to subtract days in a date in oracle pl/sql"?
I'm sure there are plenty of ways and tutorials out there, this is simply just my quick reference cheatsheet :
SET ECHO OFF
SET SERVEROUTPUT ON SIZE 1000000
SET FEEDBACK ON
SET TIMING ON
declare
l_current_date date;
l_previous_date date;
begin
l_current_date := sysdate;
l_previous_date := l_Current_Date - 1;
DBMS_OUTPUT.PUT_LINE('current_date|previous_date');
DBMS_OUTPUT.PUT_LINE(l_current_date||'|'||l_previous_date);
END;
/
show errors;
-- results
I'm sure there are plenty of ways and tutorials out there, this is simply just my quick reference cheatsheet :
SET ECHO OFF
SET SERVEROUTPUT ON SIZE 1000000
SET FEEDBACK ON
SET TIMING ON
declare
l_current_date date;
l_previous_date date;
begin
l_current_date := sysdate;
l_previous_date := l_Current_Date - 1;
DBMS_OUTPUT.PUT_LINE('current_date|previous_date');
DBMS_OUTPUT.PUT_LINE(l_current_date||'|'||l_previous_date);
END;
/
show errors;
-- results
Comments
Post a Comment