|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I have a script that stores 3 values, email, firstname and lastname in a cursor. The only problem is that it often returns many of the same values due to multiple entries in the database tables I am searching. I tried distinct, but every time the script runs I get an "ORA-01847: day of month must be between 1 and last day of month GHID". When I take out distinct the program runs fine.
Here is my code: NOW:=SYSDATE; BEFORE:=NOW - 7; OPEN output_cur FOR SELECT DISTINCT(ME.e_mail), su.pat_firstname, su.pat_lastname FROM ops_arw.member_pin ME, ops_arw.subscriber SU, ops_arw.int_med_claim_summary INT WHERE ME.SRV_EMAIL_PREFERENCE ='Y' AND ME.CERT_NO =SU.CERT_NO AND ME.CERT_NO =INT.CERT_NO AND TO_CHAR(TO_DATE(SU.MEM_DOB, 'YYYYMMDD'), 'YYYYMM')=TO_CHAR(ME.MEM_DOB, 'YYYYMM') AND INT.INSERT_DATE >= BEFORE; Thanks for the help. |
|
#2
|
|||
|
|||
|
replace
Code:
TO_CHAR(TO_DATE(SU.MEM_DOB, 'YYYYMMDD'), 'YYYYMM')=TO_CHAR(ME.MEM_DOB, 'YYYYMM') AND with Code:
TRUNC(SU.MEM_DOB) = TRUNC(ME.MEM_DOB) AND |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Question about DISTINCT |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|