Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> trouble with a decode statement

trouble with a decode statement

From: Christopher Boyle <cboyle_at_neoucom.edu>
Date: Wed, 08 Dec 1999 11:19:18 -0500
Message-ID: <384E8506.6BA1C4CE@neoucom.edu>


Hello, relative newbie here!

We have a view that was created by a consultant who seems to have forgotten to leave us the documentation. The view creates fine but if you try to do a SELECT * from it , an ora_01722 error occurs. This led me to look for any math that might have been done against date fields so i could verify that they were in fact date fields. I found these lines in the where clause

and a.fisc_year_yy =
decode(ytd.fisc_year_yy(+),'00','99',lpad(ytd.fisc_year_yy(+)-1,2,'0')) and a.fisc_month =
decode(ytd.fisc_month(+),'13','01',lpad(ytd.fisc_month(+)-1,2,'0'))

fisc_month is a char(2) in both tables. I believe i can figure out the first one but the second line eludes me. We do work with 13 fiscal months so that isn't the issue but as i follow it (read that greeting line again before you laugh) if the month is 13 it will be decoded as 01 and if not, 1 will be subtracted from it than if need be it will be filled out with "0" to two places. Will Oracle do the implicit conversion in order to process the subtraction? Should i expect an error when the fiscal month is "01" (we do not have a fiscal month "00") What might the purpose be of even making this statement an outer join since there will be a default fill in due to the decode?

Thanks in advance for your help

If you desire, replies can be directly sent to cboyle_at_neoucom.edu


Received on Wed Dec 08 1999 - 10:19:18 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US