views:

20

answers:

1

Hi i have the following sql query

SELECT
@weekenddtm = CONVERT(VARCHAR,DATEADD(DD,(7 - DATEPART(DW,@p_end_dtm)),@p_end_dtm),111)

and i tried converting it into oracle using this query

v_weekenddtm   := CAST(p_end_dtm + NUMTODSINTERVAL((7-TO_NUMBER(TO_CHAR(p_end_dtm,'D'))),'DAY')  AS DATE);

but it is giving me error..any idea how to go ahead

+1  A: 

What are the datatypes of p_end_dtm and v_weekend_dtm? Your code works if they are as follows:

declare
   p_end_dtm timestamp;
   v_weekend_dtm date;
begin
   v_weekend_dtm := CAST(p_end_dtm+ NUMTODSINTERVAL((7-TO_NUMBER(TO_CHAR(p_end_dtm,'D'))),'DAY')  AS DATE);
end;
Tony Andrews