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 the difference between nvl function, ifnull function, and isnull function?

595


Can we create table inside stored procedure?

534


How do I find duplicates in sql?

510


What is cte sql?

517


Differences between Oracle 9i and 10g (Probably in terms of SQL and PL/SQL)?

3110






What is pragma in pl sql?

602


Explain the purpose of %type and %rowtype data types with the example?

555


Why do we use joins in sql?

504


Can I learn sql in a week?

554


List different type of expressions with the example.

551


Enlist the advantages of sql.

573


What is trigger point?

540


What are sql ddl commands?

552


what is primary key? : Sql dba

512


How to use boolean type in select statement?

585