Home > database >  Oracle calculated data 0 eliminating the cause
Oracle calculated data 0 eliminating the cause

Time:10-23


SELECT decode (b. plan time, 0, 0, round (a. complete trains/b. plan time, 4)) trains completion
The from (select sum (fd) seqnum) complete trains
The from FDISDISPLANLD fd
Where fd. Routeid='80001'
And fd. The isactive=1
And (fd) isconfirm=1 or fd) recstate in (5, 24, 10))
And fd. Rectype='1'
And fd. Rundate=trunc (sysdate)) a,
(select sum (f.o vertime - f.b egintime) * 24 * 60/intervaltime) + 1 time,
F.r undate
The from fdisdispatchinterval f
Where the exists (select 1
The from McSegmentinfogs
Where segmentid=f.s egmentid
And rundirection='1')
And f.r outeid='80001'
And f.r undate=trunc (sysdate)
B)



The SQL execution result is 0.5









SELECT decode (b. plans, '0', '0', round (a. complete trains/b. plan time, 4)) trains completion
The from (select sum (fd) seqnum) complete trains
The from FDISDISPLANLD fd
Where fd. Routeid='80001'
And fd. The isactive=1
And (fd) isconfirm=1 or fd) recstate in (5, 24, 10))
And fd. Rectype='1'
And fd. Rundate=trunc (sysdate)) a,
(select sum (f.o vertime - f.b egintime) * 24 * 60/intervaltime) + 1 time,
F.r undate
The from fdisdispatchinterval f
Where the exists (select 1
The from McSegmentinfogs
Where segmentid=f.s egmentid
And rundirection='1')
And f.r outeid='80001'
And f.r undate=trunc (sysdate)
B)


Is this SQL execution results. 5 the difference between them is the first 0 each single quotation marks, the second with single quotes oracle bosses tell me what reason is this

CodePudding user response:

If I didn't guess wrong, "plan on time" field should be numeric types, and the index, with quotes, lead to don't walk the index, so the execution efficiency drops,

CodePudding user response:

Well? Isn't it

CodePudding user response:

The first result is a string, the second result is digital,,,

CodePudding user response:

The
  • Related