0
日が月曜日(またはdが2に等しい)の場合はcase selectを使用しようとしていて、 'else'は1週間おきに処理します。曜日選択イベントの構文は何ですか?
Select to_char (sysdate, 'D') d from dual,
/*if 2 or Monday then run this part*/
CASE
2
Then
SELECT DISTINCT RPAD(CLAIM.CLAIM_NUMBER, 20) ||
LPAD(CLAIM.CLAIM_ID, 15, '0') ||
TO_CHAR(CLAIM.INCIDENT_DATE, 'MMDDYYYY') ||
LPAD(' ',2) ||
'D'
FROM CLAIM,CLAIMANT,INSURER,POLICY
WHERE CLAIM.CLAIM_ID = CLAIMANT.CLAIM_ID
AND POLICY.INSURER_NUMBER = INSURER.INSURER_NUMBER
AND INSURER.INSURER_NUMBER NOT IN ('7','8')
AND CLAIMANT.EXAMINER1_CODE NOT IN ('MAYCONV')
AND CLAIM.INSURANCE_TYPE = 2
AND CLAIM.JURISDICTION_CODE <> 1
AND CLAIMANT.CLAIMANT_TYPE_CODE in (4,7)
/*if Monday then go 2 days back*/
AND CLAIMANT.EDIT_DATE > (SYSDATE - 2)
/*if not equal to 2 or any day but Monday then run this part*/
Else
SELECT DISTINCT RPAD(CLAIM.CLAIM_NUMBER, 20) ||
LPAD(CLAIM.CLAIM_ID, 15, '0') ||
TO_CHAR(CLAIM.INCIDENT_DATE, 'MMDDYYYY') ||
LPAD(' ',2) ||
'D'
FROM CLAIM,CLAIMANT,INSURER,POLICY
WHERE CLAIM.CLAIM_ID = CLAIMANT.CLAIM_ID
AND POLICY.INSURER_NUMBER = INSURER.INSURER_NUMBER
AND INSURER.INSURER_NUMBER NOT IN ('7','8')
AND CLAIMANT.EXAMINER1_CODE NOT IN ('MAYCONV')
AND CLAIM.INSURANCE_TYPE = 2
AND CLAIM.JURISDICTION_CODE <> 1
AND CLAIMANT.CLAIMANT_TYPE_CODE in (4,7)
/*if not Monday then go 1 day back*/
AND CLAIMANT.EDIT_DATE > (SYSDATE - 1)
/
[NLS設定が日番号に影響する](http://stackoverflow.com/a/14518463/266304)異なるロケールでコードを実行している他の人が別の結果を表示することがあります。 –