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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the basic sql commands?

546


What is sql and how does it work?

544


How to return multiple rows from the stored procedure?

514


How can a function retun more than one value in oracle with proper example?

580


How would you pass hints to the sql processor?

523






Is pl sql and postgresql same?

563


What is java sql drivermanager?

543


What is crud diagram?

509


What is a loop in sql?

562


What do you know by pl/sql cursors?

559


what is the functionality of the function htmlentities? : Sql dba

517


What are the advantages of stored procedure?

536


How do I find duplicates in sql?

502


What is the maximum size of sqlite database?

544


how is exception handling handled in mysql? : Sql dba

549