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 / sachin sapkal

create or replace function myfun(a in number) return number
is
n number;
begin
if (n = 1)
return 0;
else if(n = 0)
return 1;
else
dbms_output.put_line('enter 0 or 1 only...');
end if;
end;

SQL> select myfun(1) from dual;

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can I create table without primary key?

938


Can we commit in trigger?

921


What are the two characteristics of a primary key?

926


how to get help information from the server? : Sql dba

875


What is meant by truncate in sql?

1004


What version is sql?

964


How can I make sql query run faster?

960


How to rename a table?

957


What is pl/sql language case sensitive?

1059


What is difference between sql function and stored procedure?

942


Is left join same as inner join?

1021


What are the advantages of pl sql over sql?

962


What does 0 mean in sql?

911


What is serial sql?

916


What is the function that is used to transfer a pl/sql table log to a database table?

950