Page 1 of 1

How to wirte logical statement

Posted: Mon Jan 05, 2009 1:25 am
by kamalshil
Its just an simple question as i am trying to write this logic some time i am getting output some time not why its happing can you please let me know...
Can any 1 suggest me whats the correct way to write them.

Code: Select all

if columnname = 'a' or 'b' 
And this code do i have to put ('a' or'b')
OR

Code: Select all

if columnname='a' or columname='b'

And also do v have any of case statement in this

Posted: Mon Jan 05, 2009 2:08 am
by dhanashreepanse
Correct way to write is:
if columnname='a' or columname='b'

Please elaborate on what information you seek regarding Case statement.

Posted: Mon Jan 05, 2009 3:46 am
by kamalshil
dhanashreepanse wrote:Correct way to write is:
if columnname='a' or columname='b'

Please elaborate on what information you seek regarding Case statement.
case statement which be use for multiple if else type of statements.
And i also want to know is there any Decode statement we can also use?

Posted: Mon Jan 05, 2009 4:25 am
by dhanashreepanse
I believe you cannot write CASE statements in the derivations but they can be written within a function.

Posted: Mon Jan 05, 2009 4:42 am
by kamalshil
dhanashreepanse wrote:I believe you cannot write CASE statements in the derivations but they can be written within a function.
how can we do this can you please let me know?

Posted: Mon Jan 05, 2009 4:44 am
by dhanashreepanse
You can check it in DS Help.
Find for CASE

Posted: Mon Jan 05, 2009 4:52 am
by kamalshil
i got the solution and way to write the logical statment.

in correct way as :
Correct way to write is:
if columnname='a' or columname='b'

Posted: Mon Jan 05, 2009 4:05 pm
by ray.wurlod
While that is correct as far as it goes, the If expression is not complete until it has both a Then clause and an Else clause. This is because it is a value-producing expression; it must produce a value whether the test condition is true or false. If there is any possibility that any value in the test expression might be null, best practice is to test for this explicitly: however if you do not, then any null in the expression will cause the Else path of the expression to be taken, the reasoning being that you can not assert that null is "true", and the Else path is taken when the test expression is not true (not necessarily the same thing as "false").