0
I am running a database database. the use of liquibase is mandatory.
What I always do, is run the local queries and after everything ok, mount the base with the query inside the changeSet
down below:
<changeSet id="20210528-4" author="lunegreiros" dbms="oracle">
<preConditions onFail="MARK_RAN">
<columnExists columnName="WORK_ORDER_LAYER_TYPE" tableName="GA_CONF_CODE" />
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
INSERT INTO GA_CONF_CODE (ID, ORDEM, OPTION_NAME, IS_CHECKED, WORK_ORDER_LAYER_TYPE)
SELECT
SEQ_GA_CONF_CODE.NEXTVAL ID,
CONF.ORDEM +10 ORDEM,
CONF.DISPLAY_NAME DISPLAY_NAME,
0 CHECKED,
CONF.LAYER_TYPE
FROM (
SELECT 1 ORDEM, 'Production Unit' DISPLAY_NAME, 6 LAYER_TYPE
FROM DUAL
UNION
SELECT
RANK() OVER(ORDER BY LOCAL_LAYER.LOCAL_LEVEL) +1 ORDEM,
LOCAL_LAYER.DISPLAY_NAME,
LOCAL_LAYER.TYPE LAYER_TYPE
FROM GA_CONF_LABEL_LOCAL AS LOCAL_LAYER
WHERE "TYPE" = 6
) AS CONF;
</sql>
</changeSet>
- Notice I limit that
changeSet
for Oracle with thedbms="oracle"
- the execution of the base file for sqlServer worked; with another
dbms=mssql
which is beside the point. But it worked
In the above execution it accuses "error of parentheses to the right". which is well descriptive, but did not find what could cause it. the rank()
closes, the from()
closes, the insert()
At first it closes too.
What is causing this error?
"right bracket error"
- I’m not sure of the placement of
SEQ_GA_CONF_CODE.NEXTVAL ID
for theinsert
asks for aID
as a Quence (already created and working on other changesets) on the lineINSERT INTO GA_CONF_CODE (ID, ...etc
NEXTVAL
this is used in theoracle
, does not work withsql-server
that has no quence– Ricardo Pontual