DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: checking date in stored procedure

  1. #1
    Join Date
    Nov 2001
    Location
    Visalia, California
    Posts
    20

    Question

    I have a stored procedure that accepts a date parameter and I have to check for a year they will enter 01/01/2000 and I have to check if the date is between 01/01/2000/12/31/2000 how can I create a variable that if they enter 01/01/2001 the it will create the value for the variable 12/31/2001 is the calculation that can be done to add to the date.

    example
    e_date in date%type,
    v_date in varchar2
    as
    begin
    open cur1 for
    select
    type,
    date,
    id
    from t1, t2
    where t1.date between e_date and v_date


  2. #2
    Join Date
    Feb 2001
    Posts
    180
    Although parts of your question are not quit clear,
    I asume you can use the funtion trunc(sysdate,'yyyy').
    So :
    where trunc(t1.date,'yyyy') = trunc(e_date,'yyyy')


    Regards
    Ben de Boer

  3. #3
    Join Date
    Nov 2001
    Location
    Visalia, California
    Posts
    20

    Thanks

    Thanks that worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width