Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a pl/sql function if enter a value=0 then output
value=1 and vise verse with out using if and case statements.

Answer Posted / rajesh venati

Hi all this will work for that one with out using if and
case statement.

create or replace function fun(a in number) return number
is
n number;
begin
n:=mod(1,a);
return n;
end;

SQL> select fun(1) from dual;

FUN(1)
----------
0

SQL> select fun(0) from dual;

FUN(0)
----------
1

Is This Answer Correct ?    18 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is and as keyword in pl sql?

1012


What is a temporal data type?

1114


Which table is left in left join?

1062


Does inner join return duplicate rows?

1039


Is nosql relational?

999


what is bcp? When is it used?

1182


Explain select statements in sql?

1107


what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba

1134


What does a pl/sql package consist of?

1015


How much ram can sql express use?

1041


How do I create a sql database?

1055


What does where 1 1 mean in sql?

1077


Difference between truncate, delete and drop commands?

1145


What is an exception in PL/SQL? What are the two types of exceptions?

1398


Name some usages of database trigger?

1084