INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

TERADATA IF Statement Do Nothing

TERADATA IF Statement Do Nothing

(OP)
Hello guys,

I am trying to do the logic of do nothing within if statement in teradata to match the logic with other application.
I tried CONTINUE AND i got syntax error.

But in TERADATA, Unfortunately I couldn't find such command to do that hence I put PRINT '' which is not elegant.

CODE

IF CONDITION THEN
  PRINT '';
ELSE
   LOGIC
ENDIF 

Just wondering whether you guys know better syntax...

Thank you all,

RE: TERADATA IF Statement Do Nothing

What is wrong with

CODE

IF NOT CONDITION
   BEGIN
       LOGIC
   END 

Borislav Borissov
VFP9 SP2, SQL Server

RE: TERADATA IF Statement Do Nothing

(OP)
Hi, As I mentioned, I need to match the logic with other application.

RE: TERADATA IF Statement Do Nothing

You could create a worthless variable and do a worthless assignment statement in the first section. Something like:

IF Condition THEN
WORTHLESSVARIABLE = 1
ELSE
your useful logic
END

==================================
advanced cognitive capabilities and other marketing buzzwords explained with sarcastic simplicity


RE: TERADATA IF Statement Do Nothing

Adding NOT is not a big hit on the logic, is it? In any which way the condition of the original code changes, your code will just be NOT (condition).

You could also simply try and put nothing in there, no command at all. Your IF statement then only has the ELSE branch. But NOT actually just inverts this so the normal branch will be used again.

Bye, Olaf.

RE: TERADATA IF Statement Do Nothing

"I need to match the logic with other application. "
So match the logic, but adjust the syntax - use IF NOT CONDITION

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: TERADATA IF Statement Do Nothing

(OP)
Guys,

IF NOT CONDITION caused us more time to run... 09 mins 04 secs

HENCE if I use condition below.

IF CONDITION THEN
PRINT '';
ELSE
LOGIC
ENDIF

only takes 01 mins 50 secs producing the same result.

RE: TERADATA IF Statement Do Nothing

WHAT!
NO WAY!
(sorry for caps smile )

Borislav Borissov
VFP9 SP2, SQL Server

RE: TERADATA IF Statement Do Nothing

I suspect that my method, an assignment statement, may be more efficient that an I/O operation (print), and thus run even faster.

==================================
advanced cognitive capabilities and other marketing buzzwords explained with sarcastic simplicity


RE: TERADATA IF Statement Do Nothing

If you compare two sequential runs, the second method most often wins, but not because it's better, but because it can take advantage of cached data.

NOT is an operation taking no time at all in comparison to whatever else you do in your IF or ELSE branch. vcheck your sanity. I agree with Borislav Borrisov. NO WAY this is because of putting the IF statement the onye or other way. IF NO (condition THEN your-stuff ENDIF just makes it a much clearer statement than putting the code you want to do in an ELSE branch and doing some NO-operation in the IF branch. It's stupid to think that this is making the code run faster or slower.

Bye, Olaf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close