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.

Answers were Sorted based on User's Feedback



write a pl/sql function if enter a value=0 then output value=1 and vise verse with out using if and..

Answer / 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

write a pl/sql function if enter a value=0 then output value=1 and vise verse with out using if and..

Answer / ajitnayak

create or replace function vice_versa2 (inp_no number) return number
is
a number := 0;
begin

select decode(inp_no, 1, 0,1) into a from dual;

return a;

end;

Is This Answer Correct ?    1 Yes 0 No

write a pl/sql function if enter a value=0 then output value=1 and vise verse with out using if and..

Answer / 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

More SQL PLSQL Interview Questions

What is a dirty read sql?

0 Answers  


What is a bitmap index?

4 Answers   Choice Solutions, Infosys,


Like shown below i have 3 columns(Name,No,Address). The values in name column i want to modity. Requirement : Keep only once space between two words (Fname,Lname) in the Name column. For this what is the query? Please answer me. Advance Thanks. Name No Address Reference manoj kumar kumar raja vinzay kumar rajendra prasad gowri nath -- -- --

5 Answers  


Is record in oracle pl sql?

0 Answers  


What is a REF CURSOR? Compare strong and week ref cursor types.

6 Answers  


What is sql key?

0 Answers  


What is the maximum number of triggers, you can apply on a single table?

0 Answers  


How to get each name only once from an employee table?

0 Answers  


What is pl sql quora?

0 Answers  


what is difference between pass by value and eference by value in oracle plsql

1 Answers  


column A column b | output 10 7 | 10 5 8 | 8 7 -9 | 7 3 5 | 5 0 6 | 6 Write a sql query to print such output.

4 Answers  


What are code pages ?

1 Answers   BirlaSoft,


Categories