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 |
Like shown below i have 3 columns(Name,No,Address). The values in name column i want to modity. Requirement : Keep only once space between two words (Fname,Lname) in the Name column. For this what is the query? Please answer me. Advance Thanks. Name No Address Reference manoj kumar kumar raja vinzay kumar rajendra prasad gowri nath -- -- --
How can i insert data inro a table with 3 columns using FORALL?
Does oracle roll back the transaction on an error?
What is the difference between instead of trigger and after trigger?
How do I create an index in word?
What is Referential Integrity?
What are tables and fields in the database?
What is the difference between union and union all command?
what is a table in a database ? : Sql dba
What is crud sql?
Can 2 queries be executed simultaneously in a distributed database system?
What is the difference between an inner join and an outer join?