From d088ec0e74a68ee5a824b63fab39a203b10718f6 Mon Sep 17 00:00:00 2001 From: BeardimonR Date: Tue, 5 Jul 2022 09:42:19 +0300 Subject: [PATCH] fix SQL Terminator procedure --- reverse_engineering/helpers/oracleHelper.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/reverse_engineering/helpers/oracleHelper.js b/reverse_engineering/helpers/oracleHelper.js index 42ab5cc..afdf5ea 100644 --- a/reverse_engineering/helpers/oracleHelper.js +++ b/reverse_engineering/helpers/oracleHelper.js @@ -495,7 +495,9 @@ const splitEntityNames = names => { }; const setSQLTerminator = () => { - return execute(`EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR', TRUE)`); + return execute(`BEGIN + DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR', TRUE); + END;`); } const getDDL = async (tableName, schema, logger) => { @@ -548,12 +550,12 @@ const getDDL = async (tableName, schema, logger) => { : ''; const columnComments = _.map(queryObj.columnComments, c => `COMMENT ON COLUMN ${escapeName(schema)}.${escapeName(tableName)}.${escapeName(c.name)} IS ${escapeComment(c.comment)};`); - const ddl = `${queryObj.tableDDL}; - ${_.join(queryObj.indexDDLs, ';\n')}; + const ddl = `${queryObj.tableDDL} + ${_.join(queryObj.indexDDLs, '\n')} ${tableComment}\n ${_.join(columnComments, '\n')}`; return { - ddl: ddl.replaceAll(/[;]{2,}/g, ';'), + ddl: ddl, jsonColumns: queryObj.jsonColumns, countOfRecords: queryObj.countOfRecords, };