Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blank Lines in SQLPLUS output.

Status
Not open for further replies.

bghosh

Systems Engineer
Jun 2, 2019
1
0
0
IN
I have a report where it puts an empty line as below :

ALTER TABLE "C50CNT04_COLL"."CRA_CAISCOMM" ADD CONSTRAINT "CRA_CASPER" PRIMARY KEY ("AD_REF", "ACC_CD", "PARTITION_CODE")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 1024
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)

TABLESPACE "USERS" ENABLE;

It generates this report based on :

SET LINESIZE 2000

SET TERMOUT OFF

SET FEEDBACK OFF

SET HEADING OFF

SET ECHO OFF

SET VERIFY OFF

SET TERMOUT OFF

SET LONG 100000

SET TRIMSPOOL ON

SET LONGCHUNKSIZE 90000

SPOOL gen_constraint.sql


SELECT
dbms_metadata.get_ddl('REF_CONSTRAINT',constraint_name,owner)
|| ';' AS sqltext
FROM
(
SELECT
owner,
constraint_name
FROM
dba_constraints c
WHERE
(owner,table_name) IN (SELECT DISTINCT SCHEMA_NAME,TABLE_NAME FROM DATA_TABLE WHERE MASKING_RULE = 'ADD') AND constraint_type = 'R'
) t1
UNION ALL
SELECT
dbms_metadata.get_ddl('CONSTRAINT',constraint_name,owner)
|| ';' AS sqltext
FROM
(
SELECT
owner,
constraint_name
FROM
dba_constraints c
WHERE
(owner,table_name) IN (SELECT DISTINCT SCHEMA_NAME,TABLE_NAME FROM DATA_TABLE WHERE MASKING_RULE = 'ADD') AND constraint_type <> 'R'
) t2;

SPOOL OFF



As the output contains blank lines, it skips the Alter table statement and the constraint is not created. I have been trying to figure out the issue, but no success.
Please help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top