Home » SQL & PL/SQL » SQL & PL/SQL » Decode logic not working (11)
Decode logic not working [message #577678] Tue, 19 February 2013 11:06 Go to next message
cplusplus1
Messages: 40
Registered: October 2012
Location: usa
Member
Can you please tell me, what is the right syntax to use the below decode logic.

Decode(EXTRACT(MONTH FROM sysdate) > 2, ltrim_blanks(GLAMOUNTS.CR_AMOUNT_02) + ltrim_blanks(GLAMOUNTS.DB_AMOUNT_02), 0)

Thanks a lot for the helpful info.
Re: Decode logic not working [message #577680 is a reply to message #577678] Tue, 19 February 2013 11:18 Go to previous messageGo to next message
cookiemonster
Messages: 10912
Registered: September 2008
Location: Rainy Manchester
Senior Member
You want us to fix a decode that doesn't work without telling us what it's supposed to do?
Re: Decode logic not working [message #577681 is a reply to message #577680] Tue, 19 February 2013 11:28 Go to previous messageGo to next message
BlackSwan
Messages: 22703
Registered: January 2009
Senior Member
my car won't go.
tell me how to make my car go.

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/


Re: Decode logic not working [message #577687 is a reply to message #577681] Tue, 19 February 2013 12:07 Go to previous messageGo to next message
cplusplus1
Messages: 40
Registered: October 2012
Location: usa
Member
Wowf.. Clean the carburator..
Re: Decode logic not working [message #577689 is a reply to message #577687] Tue, 19 February 2013 12:18 Go to previous messageGo to next message
BlackSwan
Messages: 22703
Registered: January 2009
Senior Member
when you don't help us, then we can't help you.

You have table. We don't
You have data. We don't
You have SQL. We don't
You have requirements. We Don't

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: Decode logic not working [message #577690 is a reply to message #577678] Tue, 19 February 2013 12:22 Go to previous messageGo to next message
cplusplus1
Messages: 40
Registered: October 2012
Location: usa
Member
Blackswan, any one who knows decode logic can tell at least. If you know fine respond otherwise not a problem. I am really not expecting you to answer. now i know 40% of 19800 msgs could be what degreee.
Re: Decode logic not working [message #577691 is a reply to message #577678] Tue, 19 February 2013 12:23 Go to previous messageGo to next message
Solomon Yakobson
Messages: 1998
Registered: January 2010
Senior Member
cplusplus1 wrote on Tue, 19 February 2013 12:06
Can you please tell me, what is the right syntax to use the below decode logic.


I'll tell you what is wrong with your DECODE. For starters.

1. EXTRACT(MONTH FROM sysdate) > 2 returns a BOOLEAN while DECODE is SQL construct and SQL doesn't support BOOLEAN datatype.

2. ltrim_blanks(GLAMOUNTS.CR_AMOUNT_02) returns a string and you can't use + with strings (plus is arithmetic addition)

SY.
Re: Decode logic not working [message #577693 is a reply to message #577691] Tue, 19 February 2013 12:43 Go to previous messageGo to next message
cplusplus1
Messages: 40
Registered: October 2012
Location: usa
Member
Solomon Thank you very much for the helpful details. Thank you lot of them can learn from you here.
Re: Decode logic not working [message #577695 is a reply to message #577693] Tue, 19 February 2013 12:49 Go to previous messageGo to next message
Michel Cadot
Messages: 58902
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Unfortunately you failed to learn to:
- Read and apply OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
- Post your Oracle version, with 4 decimals.
- Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.
- Read the documentation before posting: Database SQL Reference

Regards
Michel
Re: Decode logic not working [message #577713 is a reply to message #577693] Tue, 19 February 2013 17:24 Go to previous messageGo to next message
vikram1780
Messages: 222
Registered: January 2007
Location: Bangalore
Senior Member
100 % agree with your statement.

Instead of finding out what is causing the error. Many people might have asked you a irrelevant questions.
Re: Decode logic not working [message #577718 is a reply to message #577713] Tue, 19 February 2013 18:01 Go to previous messageGo to next message
cplusplus1
Messages: 40
Registered: October 2012
Location: usa
Member
Thank you sir, at least someone thought what i thought too.
This is a special board, they always start by criticizing, one uses a old junk retired car example another an old tree example, that's how they end up with 20k messages in each of their individual accts.

I really like this site, but what can you do when you have old baba's sleeping here instead of retiring...
Re: Decode logic not working [message #577726 is a reply to message #577718] Tue, 19 February 2013 21:26 Go to previous messageGo to next message
reppihsrow
Messages: 22
Registered: October 2012
Junior Member
Quote:

This is a special board, they always start by criticizing, one uses a old junk retired car example another an old tree example, that's how they end up with 20k messages in each of their individual accts.

I really like this site, but what can you do when you have old baba's sleeping here instead of retiring...


Before you speak again like that please read this
http://www.catb.org/esr/faqs/smart-questions.html#rtfm
from beginning until the end.

Then you will realize what's wrong with you and what is the conventional environment in a forum like this
and any other forums in the world wide web.
I will tell you, you will not regret taking time to read that. (It is worth your time).

Re: Decode logic not working [message #577743 is a reply to message #577726] Wed, 20 February 2013 01:25 Go to previous message
Michel Cadot
Messages: 58902
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is a nice and smart link, thanks for it.

Regards
Michel
Previous Topic: error
Next Topic: Concat
Goto Forum:
  


Current Time: Wed Aug 27 06:30:28 CDT 2014

Total time taken to generate the page: 0.09860 seconds