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!

syntax question regarding Oracle and MSSQL using DBLink

userLynxJan 27 2012 — edited Jan 27 2012
I have an oracle database (10.2) and I have a query that needs to compare data on the Oracle database to data on a MS SQL server DB. I'm using a DB Link between the two databases.

How would I compare the date fields?

I have a table that has a date as one of the fields and I need to restrict the records where the date is equal to the date on SQL, however the formats are different:

My query is as follows:

SELECT mkt_css_name,
pmv_rqst_corp_id,
pmv_rqst_source,
'G',
pmv_css_acct_no,
eq.start_date
FROM power_move@cmdt,
enroll_que@tcis eq,
marketer@cmdt
WHERE eq.css_account_number = pmv_css_acct_no
AND eq.requestor_type = 'P'
AND eq.status IN ('A','P','G','S')
AND eq.marketer_id = mkt_seq_no
AND pmv_service_type IN ('G','D')
And Pmv_Gas_Mktr_No = Eq.Marketer_Id
AND pmv_received_timestamp= eq.enroll_date ;

The problem is that the date is stored in Oracle in the following format: DD-MON-YYYY and in SQL as 'YYYY-DD-MM HH:MI:SSSSSS'

for example: Data in Oracle would be 27-JAN-2012 and in SQL as 2012-01-27 00:00:00.000

I get an error when I compile.

How do you reconcile the formats when the syntax is different between databases?

Thanks, Sean
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 24 2012
Added on Jan 27 2012
3 comments
342 views