I am trying to select records where the parameter date is greater than/equal to a record in PA_TRANS. I want to have a date and time comparison to the records in the table. It works for only for the date portion i.e. dd/mmm/rrrr as in below:
SELECT t.SITENO, t.PA_TRANSNO, t.PA_TR_COMM, t.PA_TR_DATE, t.PA_PAYMENT_TYPE, t.USER_NAME
FROM Pa_Trans t
WHERE siteno = 8
AND t.user_name = 'HSOWNER'
AND TO_DATE((TRUNCp_transactions_upto_date)), 'dd/mm/rrrr') >= TO_DATE((TRUNC(t.pa_tr_date)), 'dd/mm/rrrr')
But for the time portion it doesn't. Do I need to TO_CHAR or TO_DATE or anything else?
SELECT t.SITENO, t.PA_TRANSNO, t.PA_TR_COMM, t.PA_TR_DATE, t.PA_PAYMENT_TYPE, t.USER_NAME
FROM Pa_Trans t
WHERE siteno = 8
AND t.user_name = 'HSOWNER'
AND TO_DATEp_transactions_upto_date, 'DD-Mon-YYYY HH24:MI:SS') >= TO_DATE(t.pa_tr_date, 'DD-Mon-YYYY HH24:MI:SS')
SELECT t.SITENO, t.PA_TRANSNO, t.PA_TR_COMM, t.PA_TR_DATE, t.PA_PAYMENT_TYPE, t.USER_NAME
FROM Pa_Trans t
WHERE siteno = 8
AND t.user_name = 'HSOWNER'
AND TO_DATE((TRUNCp_transactions_upto_date)), 'dd/mm/rrrr') >= TO_DATE((TRUNC(t.pa_tr_date)), 'dd/mm/rrrr')
But for the time portion it doesn't. Do I need to TO_CHAR or TO_DATE or anything else?
SELECT t.SITENO, t.PA_TRANSNO, t.PA_TR_COMM, t.PA_TR_DATE, t.PA_PAYMENT_TYPE, t.USER_NAME
FROM Pa_Trans t
WHERE siteno = 8
AND t.user_name = 'HSOWNER'
AND TO_DATEp_transactions_upto_date, 'DD-Mon-YYYY HH24:MI:SS') >= TO_DATE(t.pa_tr_date, 'DD-Mon-YYYY HH24:MI:SS')