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

how to use myisamchk to check or repair myisam tables? : Sql dba

965


What are sql objects?

1073


How can we implement rollback or commit statement in a trigger?

1025


What is pl sql architecture?

955


What are sql constraints?

1169


What is union and union all keyword in sql?

1027


Determine if oracle date is on a weekend?

1033


What is compound trigger?

1028


What is sql and db2?

989


Are stored procedures compiled?

912


What is a loop in sql?

976


How do sql triggers work?

1031


what is a cursor? : Sql dba

1017


What is triggering circuit?

1058


Why do we create stored procedures & functions in pl/sql and how are they different?

934