Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TERADATA IF Statement Do Nothing 1

Status
Not open for further replies.

peac3

Technical User
Jan 17, 2009
226
AU
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,
 
What is wrong with
Code:
IF NOT CONDITION
   BEGIN
       LOGIC
   END


Borislav Borissov
VFP9 SP2, SQL Server
 
Hi, As I mentioned, I need to match the logic with other application.
 
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


 
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.
 
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.
 
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.
 
WHAT!
NO WAY!
(sorry for caps :) )

Borislav Borissov
VFP9 SP2, SQL Server
 
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


 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top