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

How many columns should be in an index?

959


How does left join work in sql?

995


What is the use of stored procedures?

1040


Why is sql better than hql?

976


How run sql*plus commands that are stored in a local file?

1052


Can primary key be changed?

902


How to place comments in pl/sql?

1148


what is clause? : Sql dba

1056


Does postgresql run on the cloud?

1137


Is not equal in sql?

1006


what is top in tsql? : Transact sql

1110


What are the types of join and explain each?

1029


How delete all records from table in sql?

974


What is 19 null in sql?

950


write an sql query to find names of employee start with 'a'? : Sql dba

1020