The output of the code should not overwrite the null values.
I need the output in the attached format(1st output) and it is being shown in different format(2nd output). Please suggest me how to achieve this.

```
Customer_ID         Event_ID   Supp_CD
(null)              2534660914  (null)
(null)              2534660913  (null)
4000000000033919590 2534660916  (null)
7000000000491566892 2534660918  (null)
7000000000888215846 2534660917  (null)
7000000000945520325 2534660912  (null)
7000000000862996964 2534660919  (null)
7000000000554412111 2534660915  (null)

```

```
Customer_ID         Event_ID   Supp_CD
2534660914  
2534660913  
4000000000033919590 2534660916  
7000000000491566892 2534660918  
7000000000888215846 2534660917  
7000000000945520325 2534660912  
7000000000862996964 2534660919  
7000000000554412111 2534660915  

```

I have written the SQL script, but the formatiing of DBMS\_OUTPUT overwrites the null output. The last field SUPP\_CD is a text and first two columns consists of numbers.

```
SET SERVEROUTPUT ON FORMAT WRAPPED
SET VERIFY OFF
SET FEEDBACK OFF
SET TERMOUT ON

SPOOL /u01/apps/Miscellaneous/bin/spool.txt

DECLARE
  CSTID CDB_ADMIN.CPM_PREF_EVENT_STG.cdb_customer_id%TYPE;
  EVNTID CDB_ADMIN.CPM_PREF_EVENT_STG.cdb_pref_event_id%TYPE;
  SUPCD CDB_ADMIN.CPM_PREF_EVENT_STG.supp_cd%TYPE;
  COUNTS INTEGER:=0;

  cursor c1 is
    <select * from A.B>;

BEGIN
  DBMS_OUTPUT.PUT_LINE(LPAD('Customer_ID',25)||LPAD('Event_ID',25)||RPAD('Supp_ID',25));

  OPEN C1;
  LOOP
    FETCH C1 INTO CSTID,EVNTID,SUPCD;
    EXIT WHEN C1%NOTFOUND;
    DBMS_OUTPUT.put_line(LPAD(CSTID,25)||LPAD(EVNTID,25)||RPAD(SUPCD,25));
    COUNTS := COUNTS+1;
  END LOOP;
  CLOSE C1;

  DBMS_OUTPUT.PUT_LINE('');
  DBMS_OUTPUT.PUT_LINE('NUMBER OF ROWS: ' || COUNTS);
END;
/

SPOOL OFF;

```

I tried by writing below piece of code by replacing this line with IF statement

```
DBMS_OUTPUT.put_line(LPAD(CSTID,25)||LPAD(EVNTID,25)||RPAD(SUPCD,25));

```

```
IF CSTID is null then
dbms_output.put_line(LPAD(coalesce(null,' '),25)||LPAD(EVNTID,25)||'  '||RPAD(SUPCD,40));
end if;
IF EVNTID is null then
dbms_output.put_line(LPAD(CSTID,25)||LPAD(coalesce(null,' '),25)||'  '||RPAD(SUPCD,40));
end if;
IF SUPCD is null then
dbms_output.put_line(LPAD(CSTID,25)||LPAD(EVNTID,25)||'  '||RPAD(coalesce(null,' '),40));
end if;

```

and the output is

```
              Customer_ID                 Event_ID  Supp_ID

                                        2534660914
               2534660914
                                        2534660913
               2534660913
      4000000000033919590               2534660916

      7000000000491566892               2534660918

      7000000000888215846               2534660917

      7000000000945520325               2534660912

      7000000000862996964               2534660919

      7000000000554412111               2534660915

```

Still figuring out the solution. Please let me know if this can be done in better way.