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 three forms of normalization?

537


What is a join query?

556


what is recursive stored procedure? : Sql dba

531


what is error ora-03113: end-of-file on communication channel?

607


Cite the differences between execution of triggers and stored procedures?

626






What is a dynamic query?

574


What are the different operators available in sql?

581


When are we going to use truncate and delete?

555


How do rank () and dense_rank () differ?

524


Can we use views in stored procedure?

517


How is a PL/SQL code compiled?

675


what is the bond code in materialized view?

2492


Explain foreign key in sql?

627


What is data control language (dcl)?

603


What is insert command in sql?

530