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.
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.