Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Date in where clause

Lakshmi P3 days ago

Hi,

Im joining 2 tables based on date field in where clause.

For eg:

select cal.date_id

from stage a

left outer join calendar cal

on

a.businessdate=cal.date_id;

Its giving the error ORA-01861-literal does not match format string

Sample values and datatype of these fields :

2025-02-17 → businessdate (varchar(128 byte) type)

01-JAN-25 → date_id (DATE type)

select a.businessda,cal.date_id

from staging a left outer join calendar cal

where

to_date(a.businessdate,'YYYY-MM-DD')=to_date(cal.date_id,'YYYY-MM-DD');

The result shows as

2025-02-17 , null

But 2nd column should show 2025-02-17 since matching record exists.

Left outer join is if matching records exists show data from left and right table else show null.

Please advice.

This post has been answered by Solomon Yakobson on Feb 19 2025
Jump to Answer
Comments
Post Details
Added 3 days ago
4 comments
61 views