I want to write an sql statement in c# where I want to pass a "true" or "false" value basing on some condition... can we pass true to sql statements

Ex:

select * from emp where (empid=1234 and true);
select * from emp where (empid=1234 and false);

This true and false comes from a variable basing on a condition.

Recommended Answers

All 3 Replies

oracle does not support the data type BOOLEAN in sql.

use some flag for true and false and process accordingly.

select * from emp where (empid=1234 and 1=1);
select * from emp where (empid=1234 and 1=2);

better to use some expression that will evalute to boolean.

the previous post is a better example of the same.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.