jOOQ - слишком длинное исключение строкового литерала для длинного запроса, сгенерированного как шаг - PullRequest
1 голос
/ 22 апреля 2020

Я использую Jooq для создания оператора слияния, используя шаг слияния, например:

MergeNotMatchedSetMoreStep<InventoryRecord> mergeInsert =
    mergeUpdate
        .whenNotMatchedThenInsert()
        .set(EMPLOYEE.COLLECTEDAT, now)
        .set(EMPLOYEE.VALID, true);

for (Field<?> setField : EMPLOYEE.fields()) {
  if (setField == EMPLOYEE.COLLECTEDAT) continue;
  if (setField == EMPLOYEE.VALID) continue;
  Field<?> setValue = EMPLOYEE_VIEW.field(setField.getUnqualifiedName());
  mergeInsert = mergeInsert.set((Field<Object>) setField, setValue);
}

Как вы можете видеть выше, я делаю динамический c запрос и, наконец, выполняю его в база данных. Используемая база данных: Oracle 11g (также проверено на модернизированных совместимых версиях, но не повезло)

Я пометил jOOQ, потому что я не уверен, вызывает ли проблема мой способ построения запроса, или это oracle, который выдает ошибку.

mergeInsert.execute(); // a very long generated at this line and got an exception here

Ошибка:

"org.jooq.exception.DataAccessException: Error while running ConnectionCallable at
org.jooq_3.12.0.ORACLE11G.debug(Unknown Source) at 
org.jooq.impl.DefaultDSLContext.connectionResult(DefaultDSLContext.java:658) at 
org.jooq.impl.ExplainQuery.explain(ExplainQuery.java:66) at 
org.jooq.impl.DefaultDSLContext.explain(DefaultDSLContext.java:481) at 
net.company.retirements.web.perf.QueryPerformanceLogger$QueryMetrics.addTimedRun(QueryPerformanceLogger.java:207) at
net.company.retirements.web.perf.QueryPerformanceLogger$1.executeEnd(QueryPerformanceLogger.java:61) at 
org.jooq.impl.ExecuteListeners.executeEnd(ExecuteListeners.java:191) at 
org.jooq.impl.AbstractResultQuery.execute(AbstractResultQuery.java:295) at
org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:369) at 
org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:501) at
org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:470) at 
org.jooq.impl.AbstractResultQuery.fetchLazyNonAutoClosing(AbstractResultQuery.java:484) at
org.jooq.impl.AbstractResultQuery.fetchOne(AbstractResultQuery.java:653) at
org.jooq.impl.AbstractResultQuery.fetchOne(AbstractResultQuery.java:605) at
org.jooq.impl.AbstractResultQuery.fetchOne(AbstractResultQuery.java:611) at
org.jooq.impl.SelectImpl.fetchOne(SelectImpl.java:2847) at 
net.company.dataset.query.TypedQuery.count(TypedQuery.java:297) at 
net.company.dataset.http.DataSetResponse.fromRequest(DataSetResponse.java:70) at 
net.company.retirements.web.controllers.RequestsController.availableEquipments(RequestsController.java:226)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat 
java.lang.reflect.Method.invoke(Method.java:498)\n\tat 
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.ja
va:189)\n\tat 
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerM
ethod.java:138)\n\tat 
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHan
dle(ServletInvocableHandlerMethod.java:102)\n\tat 
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandler
Method(RequestMappingHandlerAdapter.java:895)\n\tat 
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInterna
l(RequestMappingHandlerAdapter.java:800)\n\tat 
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMe
thodAdapter.java:87)\n\tat 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)\n\tat 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)\n\tat 
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)\n\ta
t org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)\n\tat 
javax.servlet.http.HttpServlet.service(HttpServlet.java:707)\n\tat 
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)\n\tat 
javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\n\tat 
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:28
6)\n\tat 
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:26
0)\n\tat 
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)\n\tat 
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)\n\tat 
weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)\n\tat 
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)\n\tat 
org.sitemesh.webapp.contentfilter.ContentBufferingFilter.bufferAndPostProcess(ContentBufferingFi
lter.java:169)\n\tat 
org.sitemesh.webapp.contentfilter.ContentBufferingFilter.doFilter(ContentBufferingFilter.java:12
6)\n\tat org.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:120)\n\tat 
org.sitemesh.config.ConfigurableSiteMeshFilter.doFilter(ConfigurableSiteMeshFilter.java:163)\n\t
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)\n\tat 
net.company.retirements.web.filters.NotificationFilter.doFilter(NotificationFilter.java:36)\n\ta
t 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:3
57)\n\tat 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)\n\
tat weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)\n\tat 
net.company.retirements.web.filters.IdleSessionTimeoutFilter.doFilter(IdleSessionTimeoutFilter.j
ava:43)\n\tat 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:3
57)\n\tat 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)\n\
tat weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)\n\tat 
net.company.retirements.web.filters.GlobalBeansInRequestFilter.doFilter(GlobalBeansInRequestFilt
er.java:65)\n\tat 
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:3
57)\n\tat 
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)\n\
tat weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)\n\tat 
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.j
ava:320)\n\tat 
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurit
yInterceptor.java:127)\n\tat 
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:209)\n\tat org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:186)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:107)\n\tat net.company.security.filters.ToggleableFilter.doFilter(ToggleableFilter.java:44)\n\tat org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)\n\tat org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:121)\n\tat org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)\n\tat org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:121)\n\tat org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)\n\tat org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:73)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.saml.metadata.MetadataGeneratorFilter.doFilter(MetadataGeneratorFilter.java:87)\n\tat org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)\n\tat org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)\n\tat org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)\n\tat org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)\n\tat org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)\n\tat weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)\n\tat net.company.retirements.web.filters.RequestIdFilter.doFilter(RequestIdFilter.java:25)\n\tat org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)\n\tat org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)\n\tat weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)\n\tat weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32)\n\tat weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)\n\tat weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3683)\n\tat weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3649)\n\tat weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)\n\tat weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)\n\tat weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)\n\tat weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)\n\tat weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2433)\n\tat weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2281)\n\tat weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2259)\n\tat weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691)\n\tat weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651)\n\tat weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)\n\tat weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)\n\tat weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)\n\tat weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)\n\tat weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)\n\tat weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)\n\tat weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)\n\tat weblogic.work.ExecuteThread.run(ExecuteThread.java:346)\nCaused by: java.sql.SQLException: ORA-06550: line 1, column 51:\nPLS-00172: string literal too long\n\n\tat oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)\n\tat oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)\n\tat oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1059)\n\tat oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522)\n\tat oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)\n\tat oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)\n\tat oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:220)\n\tat oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:48)\n\tat oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:938)\n\tat oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1150)\n\tat oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4798)\n\tat oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:4901)\n\tat oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5631)\n\tat oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1385)\n\tat weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:119)\n\tat org.jooq.impl.ExplainQuery$1.run(ExplainQuery.java:83)\n\tat org.jooq.impl.ExplainQuery$1.run(ExplainQuery.java:66)\n\tat org.jooq.impl.DefaultDSLContext.connectionResult(DefaultDSLContext.java:655)\n\t... 130 more

SQL создается запрос:

merge into "RET_EMPLOYEE" using ((select "RET_V_EMPLOYEE"."EMPLOYEEID", "RET_V_EMPLOYEE"."TYPE", "RET_V_EMPLOYEE"."IDENTIFIER", "RET_V_EMPLOYEE"."SOURCELOCATIONID", "RET_V_EMPLOYEE"."SOURCELOCATION", "RET_V_EMPLOYEE"."SOURCEMARKET", "RET_V_EMPLOYEE"."SOURCEREGION", "RET_V_EMPLOYEE"."LOCATOR", "RET_V_EMPLOYEE"."LOCATION", "RET_V_EMPLOYEE"."LOCATIONID", "RET_V_EMPLOYEE"."LOCATIONGROUP", "RET_V_EMPLOYEE"."LOCATIONREGION", "RET_V_EMPLOYEE"."LOCATIONMARKET", "RET_V_EMPLOYEE"."LOCATIONTYPEID", "RET_V_EMPLOYEE"."PART", "RET_V_EMPLOYEE"."PARTID", "RET_V_EMPLOYEE"."DESCRIPTION", "RET_V_EMPLOYEE"."PARTSERIALIZED", "RET_V_EMPLOYEE"."CONTAINERCODE", "RET_V_EMPLOYEE"."STATUS", "RET_V_EMPLOYEE"."STATUSID", "RET_V_EMPLOYEE"."BUSINESSUNITID", "RET_V_EMPLOYEE"."BUSINESSUNIT", "RET_V_EMPLOYEE"."MFGPARTNUMBER", "RET_V_EMPLOYEE"."MANUFACTURER", "RET_V_EMPLOYEE"."LOTNUMBER", "RET_V_EMPLOYEE"."USAGECODE", "RET_V_EMPLOYEE"."FAID", "RET_V_EMPLOYEE"."ASSETCODE", "RET_V_EMPLOYEE"."DISPOSITIONCODE", "RET_V_EMPLOYEE"."VALUE", "RET_V_EMPLOYEE"."SERIALNUMBER", "RET_V_EMPLOYEE"."QUANTITY", "RET_V_EMPLOYEE"."QTYAVAILABLE", "RET_V_EMPLOYEE"."FRACTION", "RET_V_EMPLOYEE"."VENDORID", "RET_V_EMPLOYEE"."VENDORCODE", "RET_V_EMPLOYEE"."VENDORNAME", "RET_V_EMPLOYEE"."OWNERCODE", "RET_V_EMPLOYEE"."PROJECTCODE", "RET_V_EMPLOYEE"."POCODE", "RET_V_EMPLOYEE"."POLINENUMBER", "RET_V_EMPLOYEE"."COST", "RET_V_EMPLOYEE"."COST2", "RET_V_EMPLOYEE"."POCOST", "RET_V_EMPLOYEE"."TAXVALUE", "RET_V_EMPLOYEE"."OPSVALUE", "RET_V_EMPLOYEE"."ACTIVE", "RET_V_EMPLOYEE"."ASSETWARRANTYID", "RET_V_EMPLOYEE"."WARRANTYVENDORID", "RET_V_EMPLOYEE"."WARRANTYCODE", "RET_V_EMPLOYEE"."WARRANTYVENDOR", "RET_V_EMPLOYEE"."WARRANTYSTARTDATE", "RET_V_EMPLOYEE"."WARRANTYENDDATE", "RET_V_EMPLOYEE"."UNDERWARRANTY", "RET_V_EMPLOYEE"."EXPIRESINMONTHS" from "RET_V_EMPLOYEE" where 1 = 1)) "RET_V_EMPLOYEE" on ("RET_V_EMPLOYEE"."EMPLOYEEID" = "RET_EMPLOYEE"."EMPLOYEEID") when matched then update set "RET_EMPLOYEE"."COLLECTEDAT" = ?, "RET_EMPLOYEE"."VALID" = ?, "RET_EMPLOYEE"."TYPE" = "RET_V_EMPLOYEE"."TYPE", "RET_EMPLOYEE"."IDENTIFIER" = "RET_V_EMPLOYEE"."IDENTIFIER", "RET_EMPLOYEE"."SOURCELOCATIONID" = "RET_V_EMPLOYEE"."SOURCELOCATIONID", "RET_EMPLOYEE"."SOURCELOCATION" = "RET_V_EMPLOYEE"."SOURCELOCATION", "RET_EMPLOYEE"."SOURCEMARKET" = "RET_V_EMPLOYEE"."SOURCEMARKET", "RET_EMPLOYEE"."SOURCEREGION" = "RET_V_EMPLOYEE"."SOURCEREGION", "RET_EMPLOYEE"."LOCATOR" = "RET_V_EMPLOYEE"."LOCATOR", "RET_EMPLOYEE"."LOCATION" = "RET_V_EMPLOYEE"."LOCATION", "RET_EMPLOYEE"."LOCATIONID" = "RET_V_EMPLOYEE"."LOCATIONID", "RET_EMPLOYEE"."LOCATIONGROUP" = "RET_V_EMPLOYEE"."LOCATIONGROUP", "RET_EMPLOYEE"."LOCATIONREGION" = "RET_V_EMPLOYEE"."LOCATIONREGION", "RET_EMPLOYEE"."LOCATIONMARKET" = "RET_V_EMPLOYEE"."LOCATIONMARKET", "RET_EMPLOYEE"."LOCATIONTYPEID" = "RET_V_EMPLOYEE"."LOCATIONTYPEID", "RET_EMPLOYEE"."PART" = "RET_V_EMPLOYEE"."PART", "RET_EMPLOYEE"."PARTID" = "RET_V_EMPLOYEE"."PARTID", "RET_EMPLOYEE"."DESCRIPTION" = "RET_V_EMPLOYEE"."DESCRIPTION", "RET_EMPLOYEE"."PARTSERIALIZED" = "RET_V_EMPLOYEE"."PARTSERIALIZED", "RET_EMPLOYEE"."CONTAINERCODE" = "RET_V_EMPLOYEE"."CONTAINERCODE", "RET_EMPLOYEE"."STATUS" = "RET_V_EMPLOYEE"."STATUS", "RET_EMPLOYEE"."STATUSID" = "RET_V_EMPLOYEE"."STATUSID", "RET_EMPLOYEE"."BUSINESSUNITID" = "RET_V_EMPLOYEE"."BUSINESSUNITID", "RET_EMPLOYEE"."BUSINESSUNIT" = "RET_V_EMPLOYEE"."BUSINESSUNIT", "RET_EMPLOYEE"."MFGPARTNUMBER" = "RET_V_EMPLOYEE"."MFGPARTNUMBER", "RET_EMPLOYEE"."MANUFACTURER" = "RET_V_EMPLOYEE"."MANUFACTURER", "RET_EMPLOYEE"."LOTNUMBER" = "RET_V_EMPLOYEE"."LOTNUMBER", "RET_EMPLOYEE"."USAGECODE" = "RET_V_EMPLOYEE"."USAGECODE", "RET_EMPLOYEE"."FAID" = "RET_V_EMPLOYEE"."FAID", "RET_EMPLOYEE"."ASSETCODE" = "RET_V_EMPLOYEE"."ASSETCODE", "RET_EMPLOYEE"."DISPOSITIONCODE" = "RET_V_EMPLOYEE"."DISPOSITIONCODE", "RET_EMPLOYEE"."VALUE" = "RET_V_EMPLOYEE"."VALUE", "RET_EMPLOYEE"."SERIALNUMBER" = "RET_V_EMPLOYEE"."SERIALNUMBER", "RET_EMPLOYEE"."QUANTITY" = "RET_V_EMPLOYEE"."QUANTITY", "RET_EMPLOYEE"."QTYAVAILABLE" = "RET_V_EMPLOYEE"."QTYAVAILABLE", "RET_EMPLOYEE"."VENDORID" = "RET_V_EMPLOYEE"."VENDORID", "RET_EMPLOYEE"."VENDORCODE" = "RET_V_EMPLOYEE"."VENDORCODE", "RET_EMPLOYEE"."VENDORNAME" = "RET_V_EMPLOYEE"."VENDORNAME", "RET_EMPLOYEE"."OWNERCODE" = "RET_V_EMPLOYEE"."OWNERCODE", "RET_EMPLOYEE"."PROJECTCODE" = "RET_V_EMPLOYEE"."PROJECTCODE", "RET_EMPLOYEE"."POCODE" = "RET_V_EMPLOYEE"."POCODE", "RET_EMPLOYEE"."POLINENUMBER" = "RET_V_EMPLOYEE"."POLINENUMBER", "RET_EMPLOYEE"."COST" = "RET_V_EMPLOYEE"."COST", "RET_EMPLOYEE"."COST2" = "RET_V_EMPLOYEE"."COST2", "RET_EMPLOYEE"."POCOST" = "RET_V_EMPLOYEE"."POCOST", "RET_EMPLOYEE"."TAXVALUE" = "RET_V_EMPLOYEE"."TAXVALUE", "RET_EMPLOYEE"."OPSVALUE" = "RET_V_EMPLOYEE"."OPSVALUE", "RET_EMPLOYEE"."ACTIVE" = "RET_V_EMPLOYEE"."ACTIVE", "RET_EMPLOYEE"."ASSETWARRANTYID" = "RET_V_EMPLOYEE"."ASSETWARRANTYID", "RET_EMPLOYEE"."WARRANTYVENDORID" = "RET_V_EMPLOYEE"."WARRANTYVENDORID", "RET_EMPLOYEE"."WARRANTYCODE" = "RET_V_EMPLOYEE"."WARRANTYCODE", "RET_EMPLOYEE"."WARRANTYVENDOR" = "RET_V_EMPLOYEE"."WARRANTYVENDOR", "RET_EMPLOYEE"."WARRANTYSTARTDATE" = "RET_V_EMPLOYEE"."WARRANTYSTARTDATE", "RET_EMPLOYEE"."WARRANTYENDDATE" = "RET_V_EMPLOYEE"."WARRANTYENDDATE", "RET_EMPLOYEE"."UNDERWARRANTY" = "RET_V_EMPLOYEE"."UNDERWARRANTY", "RET_EMPLOYEE"."EXPIRESINMONTHS" = "RET_V_EMPLOYEE"."EXPIRESINMONTHS", "RET_EMPLOYEE"."FRACTION" = "RET_V_EMPLOYEE"."FRACTION" when not matched then insert ("COLLECTEDAT", "VALID", "EMPLOYEEID", "TYPE", "IDENTIFIER", "SOURCELOCATIONID", "SOURCELOCATION", "SOURCEMARKET", "SOURCEREGION", "LOCATOR", "LOCATION", "LOCATIONID", "LOCATIONGROUP", "LOCATIONREGION", "LOCATIONMARKET", "LOCATIONTYPEID", "PART", "PARTID", "DESCRIPTION", "PARTSERIALIZED", "CONTAINERCODE", "STATUS", "STATUSID", "BUSINESSUNITID", "BUSINESSUNIT", "MFGPARTNUMBER", "MANUFACTURER", "LOTNUMBER", "USAGECODE", "FAID", "ASSETCODE", "DISPOSITIONCODE", "VALUE", "SERIALNUMBER", "QUANTITY", "QTYAVAILABLE", "VENDORID", "VENDORCODE", "VENDORNAME", "OWNERCODE", "PROJECTCODE", "POCODE", "POLINENUMBER", "COST", "COST2", "POCOST", "TAXVALUE", "OPSVALUE", "ACTIVE", "ASSETWARRANTYID", "WARRANTYVENDORID", "WARRANTYCODE", "WARRANTYVENDOR", "WARRANTYSTARTDATE", "WARRANTYENDDATE", "UNDERWARRANTY", "EXPIRESINMONTHS", "FRACTION") values (?, ?, "RET_V_EMPLOYEE"."EMPLOYEEID", "RET_V_EMPLOYEE"."TYPE", "RET_V_EMPLOYEE"."IDENTIFIER", "RET_V_EMPLOYEE"."SOURCELOCATIONID", "RET_V_EMPLOYEE"."SOURCELOCATION", "RET_V_EMPLOYEE"."SOURCEMARKET", "RET_V_EMPLOYEE"."SOURCEREGION", "RET_V_EMPLOYEE"."LOCATOR", "RET_V_EMPLOYEE"."LOCATION", "RET_V_EMPLOYEE"."LOCATIONID", "RET_V_EMPLOYEE"."LOCATIONGROUP", "RET_V_EMPLOYEE"."LOCATIONREGION", "RET_V_EMPLOYEE"."LOCATIONMARKET", "RET_V_EMPLOYEE"."LOCATIONTYPEID", "RET_V_EMPLOYEE"."PART", "RET_V_EMPLOYEE"."PARTID", "RET_V_EMPLOYEE"."DESCRIPTION", "RET_V_EMPLOYEE"."PARTSERIALIZED", "RET_V_EMPLOYEE"."CONTAINERCODE", "RET_V_EMPLOYEE"."STATUS", "RET_V_EMPLOYEE"."STATUSID", "RET_V_EMPLOYEE"."BUSINESSUNITID", "RET_V_EMPLOYEE"."BUSINESSUNIT", "RET_V_EMPLOYEE"."MFGPARTNUMBER", "RET_V_EMPLOYEE"."MANUFACTURER", "RET_V_EMPLOYEE"."LOTNUMBER", "RET_V_EMPLOYEE"."USAGECODE", "RET_V_EMPLOYEE"."FAID", "RET_V_EMPLOYEE"."ASSETCODE", "RET_V_EMPLOYEE"."DISPOSITIONCODE", "RET_V_EMPLOYEE"."VALUE", "RET_V_EMPLOYEE"."SERIALNUMBER", "RET_V_EMPLOYEE"."QUANTITY", "RET_V_EMPLOYEE"."QTYAVAILABLE", "RET_V_EMPLOYEE"."VENDORID", "RET_V_EMPLOYEE"."VENDORCODE", "RET_V_EMPLOYEE"."VENDORNAME", "RET_V_EMPLOYEE"."OWNERCODE", "RET_V_EMPLOYEE"."PROJECTCODE", "RET_V_EMPLOYEE"."POCODE", "RET_V_EMPLOYEE"."POLINENUMBER", "RET_V_EMPLOYEE"."COST", "RET_V_EMPLOYEE"."COST2", "RET_V_EMPLOYEE"."POCOST", "RET_V_EMPLOYEE"."TAXVALUE", "RET_V_EMPLOYEE"."OPSVALUE", "RET_V_EMPLOYEE"."ACTIVE", "RET_V_EMPLOYEE"."ASSETWARRANTYID", "RET_V_EMPLOYEE"."WARRANTYVENDORID", "RET_V_EMPLOYEE"."WARRANTYCODE", "RET_V_EMPLOYEE"."WARRANTYVENDOR", "RET_V_EMPLOYEE"."WARRANTYSTARTDATE", "RET_V_EMPLOYEE"."WARRANTYENDDATE", "RET_V_EMPLOYEE"."UNDERWARRANTY", "RET_V_EMPLOYEE"."EXPIRESINMONTHS", "RET_V_EMPLOYEE"."FRACTION")

Таблица назначения:

CREATE TABLE RET_EMPLOYEE
(
    EMPLOYEEID       VARCHAR2(41)
        CONSTRAINT RET_EMPLOYEEPK PRIMARY KEY,
    TYPE              VARCHAR2(5),
    IDENTIFIER        NUMBER,
    COLLECTEDAT       TIMESTAMP(6) WITH TIME ZONE,
    VALID             CHAR,
    SOURCELOCATIONID  NUMBER,
    SOURCELOCATION    VARCHAR2(100),
    SOURCEMARKET      VARCHAR2(50),
    SOURCEREGION      VARCHAR2(150),
    LOCATOR           VARCHAR2(50),
    LOCATION          VARCHAR2(100),
    LOCATIONID        NUMBER,
    LOCATIONGROUP     VARCHAR2(50),
    LOCATIONREGION    VARCHAR2(150),
    LOCATIONMARKET    VARCHAR2(50),
    LOCATIONTYPEID    NUMBER,
    PART              VARCHAR2(50),
    PARTID            NUMBER,
    DESCRIPTION       VARCHAR2(255),
    PARTSERIALIZED    CHAR,
    CONTAINERCODE     VARCHAR2(50),
    STATUS            VARCHAR2(50),
    STATUSID          NUMBER,
    BUSINESSUNITID    NUMBER,
    BUSINESSUNIT      VARCHAR2(101),
    MFGPARTNUMBER     VARCHAR2(50),
    MANUFACTURER      VARCHAR2(50),
    LOTNUMBER         VARCHAR2(50),
    USAGECODE         VARCHAR2(50),
    FAID              VARCHAR2(50),
    ASSETCODE         VARCHAR2(50),
    DISPOSITIONCODE   VARCHAR2(50),
    VALUE             NUMBER,
    SERIALNUMBER      VARCHAR2(50),
    QUANTITY          NUMBER,
    QTYAVAILABLE      NUMBER,
    VENDORID          NUMBER,
    VENDORCODE        VARCHAR2(50),
    VENDORNAME        VARCHAR2(255),
    OWNERCODE         VARCHAR2(50),
    PROJECTCODE       VARCHAR2(50),
    POCODE            VARCHAR2(50),
    POLINENUMBER      VARCHAR2(50),
    COST              NUMBER,
    COST2             NUMBER,
    POCOST            NUMBER,
    TAXVALUE          NUMBER,
    OPSVALUE          NUMBER,
    ACTIVE            CHAR,
    ASSETWARRANTYID   NUMBER,
    WARRANTYVENDORID  NUMBER,
    WARRANTYCODE      VARCHAR2(50),
    WARRANTYVENDOR    VARCHAR2(255),
    WARRANTYSTARTDATE DATE,
    WARRANTYENDDATE   DATE,
    UNDERWARRANTY     VARCHAR2(1),
    EXPIRESINMONTHS   NUMBER,
    FRACTION CHAR(1) DEFAULT 'N'
);

CREATE UNIQUE INDEX RET_EMPLOYEEI1 ON RET_EMPLOYEE (TYPE, IDENTIFIER);
CREATE UNIQUE INDEX RET_EMPLOYEEI2 ON RET_EMPLOYEE (VALID, COLLECTEDAT);
...