How to use TTITLE/BTITLE/LEFT/RIGHT(reporting commands) in PL SQL program

How to use TTITLE/BTITLE/LEFT/RIGHT(reporting commands) in PL SQL program.

I tried using in pl/sql program top title/btitle is working or coming up.
When used with sql every thing is working as expected.

PL/SQL program used
===============
set serveroutput on
set head on
TTITLE CENTER "THE XXX LIMITED" SKIP 3 -
LEFT "TEST" -
RIGHT "ANOTHEAR TEST" SKIP1 -
LEFT "======================"
declare
        empno emp1.emp_no%type;
        name varchar2(20);
        sal1 number;
        begin
                select emp_no,emp_name,sal into empno,name,sal1 from
                emp1 where emp_no='125';

                if (sal1>2000.00) then
                        update emp1 set sal=sal1*0.2 + sal1 where emp_no=125;
                else
                        update emp1 set sal=sal1 where emp_no=125;
                end if;
                dbms_output.put_line('Final Number : '|| name);
        end;
/

SQL PROGRAM USED
=================
SET LINESIZE 61
TTITLE CENTER "THE XXXXXXX D" SKIP 3 -
LEFT "TEST" -
RIGHT "ANOTHEAR TEST" SKIP1 -
LEFT "======================"
select * from dual;
umesh4expAsked:
Who is Participating?
 
flow01Connect With a Mentor Commented:
So you have to create your own  "title"  code  in pl/sql

begin
 dbms_output.put_line('                       THE XXXXXXX D   ....'  || chr(10) || chr(13) ||  chr(10) || chr(13) || 'TEST');
END;
/

(add an chr(10)  or chr(10 || chr(13)  to skip a line)
or  

show the title by means of sqlplus before executing the pl/sql block

SQL> column dontshow noprint
SQL> select null dontshow from dual;

or
insert the results in a (temporary) table to make them available to sql*plus

create global temporary table temp_results (nr_line number, rsl_line varchar(255));
set head off


begin
    delete from temp_results;
    ....
    insert into temp_results  value ( 1, 'Final Number : '|| name);
end;
/


select rsl_line from temp_results order by nr_line;
0
 
Naveen KumarConnect With a Mentor Production Manager / Application Support ManagerCommented:
There are the SQL*PLUS formatting commands/options for the reporting right, so they might not work well with pl/sql.

But what is your issue here ?

What is the output you need and what is the current output you are getting ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.