can i use dbms_output.put_line in a function u are telling
as return statement

Answer Posted / gourvendra singh

Yes we can use the dbms_output.put_line in a function and
it will print the msg when we execute Function_name, it
will not display any value if we use the function to return
a value, consider the following code:
create or replace function abc_test return char is
a varchar2(20);
begin
select dname into a from dept where deptno=20;
dbms_output.put_line('the dept is ');
return a;
exception
when others then
a:='no dept';
dbms_output.put_line('the dept is ');
return a;
end;

this will work.

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is heap table? : Sql dba

694


What is the primary use of normalization?

615


how to fetch common records from two tables? : Sql dba

737


which tcp/ip port does sql server run on? : Sql dba

626


Should I use mbr or gpt?

631






How do you drop a trigger?

630


How to run sql*plus commands in sql developer?

689


Explain alias in sql?

674


How do I order columns in sql?

619


What is difference between group by and partition by?

587


Can we write dml inside a function in sql server?

592


What are all the different normalizations?

669


What is difference between hql and native sql?

671


Does sql profiler affect performance?

637


What is the difference between clustered and non-clustered index in sql?

620