How to compare data depend on operator field using SQL ??

Database
Teradata Employee

How to compare data depend on operator field using SQL ??

Please I want to compare data according to field contains operator exists in the same table without using case condition

 

The below picture shows the tables contentCapture02.JPG

 

 

 

 

 

I need a code that can extract the data from Hurdle_Operator and compare it automatically with Hurdle_Threshold

 

Ex:

Var_Data  Extract(Hurdle_Operator) Hurdle_Threshold

20 >= 12

 

 

2 REPLIES
Teradata Employee

Re: How to compare data depend on operator field using SQL ??

Hi basant_nabil,

 

I think you have within a stored procedure, to build the string you want to operate and execute immediate it.

Maybe an external UDF / SCRIPT operator could do the trick.

Teradata Employee

Re: How to compare data depend on operator field using SQL ??

Oh also maybe there is something to dig using XMLQuery :

select cast(xmlquery('20 >= 12' returning content) as varchar(5) character set unicode) as tst;

tst
-----
true

Not sure how to use it against a table.