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 nvarchar in sql?

884


Can sql function call stored procedure?

955


Is it possible to update views?

912


Explain cursor types?

951


What are packages in pl sql and also explain its advantages?

958


How do you select unique values in sql?

932


What is a column in a table?

1060


What is the purpose of design view?

948


How many sql are there?

922


How would you convert date into julian date format?

946


What is raid? How does it help storage of databases?

1030


What is the usage of when clause in trigger?

987


What do you understand by pl/sql records?

959


What are the query optimization techniques?

882


What is before and after trigger?

886