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

What are the two different parts of the pl/sql packages?

570


What is mutating sql table?

613


Does google use sql?

518


What is normalization sql?

514


What is a mutating table and a constraining table?

575






Is primary key a clustered index?

539


how can we know the count/number of elements of an array? : Sql dba

578


How to assign sql query results to pl sql variables?

515


What is the primary key?

540


what are the 'mysql' command line options? : Sql dba

561


What are the types of optimization?

523


what is bcp? When is it used?

585


What is sorting in sql?

505


How do I start sql profiler?

561


What is where clause in sql?

537