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

Is it possible to pass parameters to triggers?

1083


What is database migration?

948


What is bulk collect in pl sql?

1073


what is unique key constraint? : Sql dba

1021


What do you know by pl/sql cursors?

1089


How do I find duplicates in the same column?

1056


What is time based sql injection?

942


What is a primary key? Explain

960


What are different sql data types?

1014


Why is sql*loader direct path so fast?

1090


how to implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql dba

957


Is hadoop a nosql?

982


Explain the difference between sql and mysql.

1040


how to convert character strings to numeric values? : Sql dba

1078


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

1013