Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL DECODE issue where search field is Like and not specific
Hi,
No comments, just a solution:
Try decode(substr(contract,length(contract),1), 'Q', Line*4, 'M', Line*12, 'H', Line*2, 'Y', Line, 0)
The trick is of course to 'strip' your contracts to the specific values.
Hope this helps.
Regards,
Michael Ringbo
Peter Stephen Drage wrote:
> The problem is that when using a decode statement the search seems to have
> to be specific i.e. 1,2,etc. I am searching on the fact that a contract ends
> with M,H,Q,Y and the result will depend upon only the ending .
> I have entered the decode statement :-
> decode((Contract),'%Q',(Line*4),'%M', (Line*12),'%H',
> (Line*2),'%Y',(Line),0)
> I get results all of the default 0
> I have also tried %'M' and Like '%M'
> I have checked the company's Oracle SQL training manuals, specific cases are
> all that are covered.
> The only other time that I have used decode is when the search is specific
> but this has now got me baffled
> Comments and suggestions greatly appreciated
> Thanks
>
> J
Received on Fri Jul 02 1999 - 05:42:01 CDT
![]() |
![]() |