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
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 |
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 |
Why self join is used in sql?
What is the difference between between and in condition operators?
What are the different operators available in sql?
What does where 1/2 mean in sql?
how to create object in plsql
differentiate between float and double. : Sql dba
Can a foreign key be a duplicate?
I have done oracle 10g. I need a project knowledge. So if u please send a project how it should be done,Or you can send email link. I will be very grateful to u.
What are the types of sql commands?
what is the bond code in materialized view?
I have a procedure in a procedure. The inner procedure contains out parameter. How I can call the inner procedure in the out procedure and send the inner procedure parameter value(out parameter value) into out procedure?
How to return multiple records from procedure?