我正在尝试运行此查询,但它没有返回任何内容。它将用户输入作为查询的变量。我必须提到的一件事是用户何时离开batch_number
s textbox empty, the query should return all the batches of the
organization_ID`。这是查询:
SELECT Nvl(a.ORGANIZATION_ID, ' '),
Nvl(a.FILE_TYPE, ' '),
Nvl(a.BATCH_NUMBER, ' '),
Nvl(a.FILE_NAME, ' '),
Nvl(TOTAL_ANB_RECORDS, 0)
FROM PAYMENT B,
PAYROLL A
WHERE b.ORGANIZATION_ID = a.ORGANIZATION_ID
AND a.ORGANIZATION_ID = '1176'
AND PAYMENT_TYPE = '1'
AND Nvl(PAYMENT_STATUS, 'a') = '5'
AND ( BM_BATCH_INDC = '0'
OR BM_BATCH_INDC = '1'
OR BM_BATCH_INDC = '3' )
AND b.FILE_TYPE = a.FILE_TYPE
AND b.FILE_BATCH_NUMBER = a.BATCH_NUMBER
AND ( b.FILE_BATCH_NUMBER = '"+textBox.text.ToString()+"'
OR b.FILE_BATCH_NUMBER IS NULL )
AND b.PAYMENT_PATH = '01';
答案 0 :(得分:0)
假设它是空白数据是否为空
写一下
AND b.FILE_BATCH_NUMBER = NVL(a.BATCH_NUMBER,b.FILE_BATCH_NUMBER)
代替
AND b.FILE_BATCH_NUMBER = a.BATCH_NUMBER
AND ( b.FILE_BATCH_NUMBER = '"+textBox.text.ToString()+"'
OR b.FILE_BATCH_NUMBER IS NULL )
如果Batch_number为null,则对所有file_batch_number
返回true