Sushant Torankar

Sushant Torankar

  • 2k
  • 140
  • 6.7k

About between date range query

Jan 28 2023 5:14 PM


I want to get records between date range, using Oracle-PL/Sql.

Following is the query:

Select * From [Table_Name]

where (to_date(P_End_Date, 'DD/MM/YYYY') between to_date(FromDate, 'DD/MM/YYYY') and to_date(ToDate, 'DD/MM/YYYY'));

P_End_Date, FromDate and ToDate are of Varchar datatype

I am getting error in query as ORA - 01843:Not a valid month

P_End_Date column has Hypen(-) or Slash(/) in some records in my table, will it affect error in query ?


Thank you

Answers (3)