How to remove unnecessary line breaks in SQL Plus Spooling?

老子叫甜甜 提交于 2019-12-02 07:58:56

问题


I am spooling a package from a database and this is what I get:

CREATE OR REPLACE PACKAGE BODY "CPI"."GIPI_WBOND_BASIC_PKG"                   
    AS                                                                              
       FUNCTION get_gipi_wbond_basic (p_par_id gipi_wbond_basic.par_id%TYPE)        
          RETURN gipi_wbond_basic_tab PIPELINED                                     
       IS                                                                           
          v_wbond   gipi_wbond_basic_type;                                          
       BEGIN                                                                        
          FOR i IN (SELECT a.par_id,        a.obligee_no,    a.bond_dtl,      a.inde
    mnity_text,                                                                     
                           a.clause_type,   a.waiver_limit,  a.contract_date, a.cont
    ract_dtl,                                                                       
                           a.prin_id,       a.co_prin_sw,    a.np_no,         a.coll
    _flag,                                                                          
                           a.plaintiff_dtl, a.defendant_dtl, a.civil_case_no        
                      FROM gipi_wbond_basic a                                       
                     WHERE a.par_id = p_par_id)  

And I am expecting it to be something like this:

CREATE OR REPLACE PACKAGE BODY cpi.gipi_wbond_basic_pkg
AS
   FUNCTION get_gipi_wbond_basic (p_par_id gipi_wbond_basic.par_id%TYPE)
      RETURN gipi_wbond_basic_tab PIPELINED
   IS
      v_wbond   gipi_wbond_basic_type;
   BEGIN
      FOR i IN (SELECT a.par_id, a.obligee_no, a.bond_dtl, a.indemnity_text,
                       a.clause_type, a.waiver_limit, a.contract_date,
                       a.contract_dtl, a.prin_id, a.co_prin_sw, a.np_no,
                       a.coll_flag, a.plaintiff_dtl, a.defendant_dtl,
                       a.civil_case_no
                  FROM gipi_wbond_basic a
                 WHERE a.par_id = p_par_id)

Please help me on how can I get rid of those new lines and ugly format. Thanks!


回答1:


Ok this one solved my problem.

From this,

SET HEADING OFF;
SET ECHO OFF;
SET PAGES 999;
SET LONG 999999;

I added this:

SET LONGCHUNKSIZE 999999;
SET PAGESIZE 0;
SET LINESIZE 500;



回答2:


You can do it using the regular expression in SSMS:

1) Ctrl-H to bring up the Find And Replace window 2) Select USE -> Regular Expressions 3) Put ^\n in the Find What 4) Keep Replace With empty 5) Click Replace (All)

Good luck -- Nilesh Umaretiya (India)



来源:https://stackoverflow.com/questions/26601251/how-to-remove-unnecessary-line-breaks-in-sql-plus-spooling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!