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
Is it possible to pass parameters to triggers?
What is database migration?
What is bulk collect in pl sql?
what is unique key constraint? : Sql dba
What do you know by pl/sql cursors?
How do I find duplicates in the same column?
What is time based sql injection?
What is a primary key? Explain
What are different sql data types?
Why is sql*loader direct path so fast?
how to implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql dba
Is hadoop a nosql?
Explain the difference between sql and mysql.
how to convert character strings to numeric values? : Sql dba
What are packages in pl sql and also explain its advantages?