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

what is top in tsql? : Transact sql

1086


What is the use of non clustered index?

976


Is sqlite free?

949


When a dml statement is executed, in which cursor attributes, the outcome of the statement is saved?

1090


What are character functions in sql?

920


What is set transaction?

1018


How does cross join work in sql?

1001


How do I run a pl sql procedure in sql developer?

952


what is a field in a database ? : Sql dba

1041


What is full join?

930


what is view? : Sql dba

939


Can we use joins in subquery?

1141


How to pipe multiline string to isql?

998


What are types of indexes in sql?

1064


What is the best free sql database?

1040