Skip to content
Snippets Groups Projects
Commit dfae5296 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Correction de l'erreur lors de la génération du SQL : ORA-01789: query block...

Correction de l'erreur lors de la génération du SQL : ORA-01789: query block has incorrect number of result columns
parent 7d9d375d
Branches
Tags
No related merge requests found
Pipeline #4749 passed
...@@ -302,7 +302,7 @@ EOS; ...@@ -302,7 +302,7 @@ EOS;
$refConstraintsSql = NULL; $refConstraintsSql = NULL;
if ($refConstraintsIncluded) { if ($refConstraintsIncluded) {
$refConstraintsSql = $this->generateSQLForRefConstraintsCreation($connection); $refConstraintsSql = $this->generateSQLForRefConstraintsCreation($connection, true);
$refConstraintsSql = <<<EOS $refConstraintsSql = <<<EOS
UNION ALL UNION ALL
...@@ -448,16 +448,14 @@ EOS; ...@@ -448,16 +448,14 @@ EOS;
/** /**
* @param Connection $connection * @param Connection $connection
* @param bool $innerSQLOnly
* @return string * @return string
*/ */
function generateSQLForRefConstraintsCreation(Connection $connection) function generateSQLForRefConstraintsCreation(Connection $connection, $innerSQLOnly = false)
{ {
$schemaName = $this->extractSchemaNameFromConnection($connection); $schemaName = $this->extractSchemaNameFromConnection($connection);
return <<<EOS $sql = <<<EOS
SELECT sql from (
-- --
-- reference constraints -- reference constraints
-- --
...@@ -472,9 +470,19 @@ SELECT sql from ( ...@@ -472,9 +470,19 @@ SELECT sql from (
where owner = '$schemaName' where owner = '$schemaName'
and constraint_type = 'R' and constraint_type = 'R'
EOS;
if (! $innerSQLOnly) {
$sql = <<<EOS
SELECT sql from (
$sql
) )
ORDER BY ORD ORDER BY ORD
EOS; EOS;
}
return $sql;
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment