Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

KLast date of month 4

Status
Not open for further replies.

Cretin

Technical User
Jan 2, 2003
194
US
I am trying to create a function. When a record comes in it and is processed We need to calculate the last date of the previous month. That works but when I try to put it in a function so I can pass that date to another program on compile I get the message: ORA-00922 missing or invalid option. I have tried numerous things. I am not a programmer however all of our developers are buried so they gave this to me. Any help I get is appreciated. Below is my code:

set serveroutput on

create or replace
function date_function(v_out in VARCHAR2, v_date in DATE)
return CHAR




-- 1
select trunc(sysdate, 'mon') -1 from dual;

-- 2

declare
v_date date;
v_out varchar2(10);
begin

v_date := to_date('20100820', 'yyyymmdd');
v_out := to_char(trunc(v_date, 'mon') -1, 'mm/dd/yyyy');
dbms_output.put_line(to_char(v_date, 'mm/dd/yyyy'));
dbms_output.put_line(v_out);
return v_out;
end;



Cretin
 
It has been in production a while now. Thank you all for your help I shall be sending in a small contribution, thanks again.

Cretin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top