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 you load data into multiple tables at once? : aql loader

1117


How do I write a cron which will run a sql query and mail the results to agroup?

1029


What does dml mean?

1041


What is primary key and foreign key with example?

981


What is nested table in pl sql?

1121


What is synchronized subquery?

1216


Is left join faster than join?

1096


What is audit logout in sql profiler?

1073


What is indexing in sql and its types?

1131


What is sap sql anywhere?

1162


What does the sign mean in sql?

1047


What is $$ in sql?

1042


What is parallel hint?

1411


How do I partition in sql?

1019


how to include character strings in sql statements? : Sql dba

1133