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 do you rename a table in sql?

532


What is use of package in pl sql?

532


What packages are available to pl/sql developers?

601


What version is sql?

553


What is the difference between a procedure and a function?

494






Enlist some predefined exceptions?

580


Do foreign keys improve performance?

543


discuss about myisam key cache. : Sql dba

561


Is foreign key mandatory?

554


What is substitution variable in pl sql?

503


What is pl sql variable?

503


What is sql exception?

515


What is difference between hql and sql?

503


What is parameter substitution in sql?

523


Is join and inner join the same?

539