Generated SQL statement contains unnecessary cast
I have a table containing a column of type decimal(10,0). Generated entity model maps this to a int32. When I perform a query on this field, for example
test.Where(p => p.id = 10)
the generated query contains the following
where (Cast(id as number (19,0)) = 10)
the prevents the server from using indexes on this column.
How can i prevent this unnecessary cast?
I follow your description but cannot reproduce the extra casting in the WHERE clause in the generated SQL.
Are you using the lastest ODAC production version (11.2.0.3) ?
When id column is defined as decimal(10, 0), it's indeed mapped to Int32 as you described.
That's because decimal(10, 0) is actually number(10).
10 is Int32 by default and ID column is already mapped to Int32. I don't see there is casting.
The only way I can reproduce the extra casting is explicitly adding decimal casting to 10. For example,
test.Where(p => p.id == (decimal) 10)
Then I got the following:
WHERE (10 = ( CAST( "Extent1"."ID" AS number(19,0))))
But I don't think that's what you did.
Would you please provide more details?
Similar Messages
-
How to examine the generated SQL statement in Receiver JDBC Adapter
I have been searching this forum how to display te generated sql statement (by the jdbc receiver adapter).
The only suggestion is to use RWB, but I was unable to find any details about how to do so.
Any help is appreciatedHi,
To add, u can see the SQL Statements in Audit log of RWB.
Select Message Monitoring-> Adapter Engine. choose ur entry and click on Details option button, u can see the SQL Statements in Audit Log.
Regards,
Sudharshan
Message was edited by:
Sudharshan Aravamudan -
Not able to View generated SQL statement
Hi,
In order to view the generated SQL statement in Receiver JDBC Adapter,
i have done logSQLStatement as true in CC still not able to view in RWB,
also mesg protocol i m using in CC is "xml sql format", is it bcos of this i am not able to ?
If yes, then how can i see that sql string?
Regards,
PratibhaPratibha,
In our JDBC scenario the message protocol is also set to XML SQL Format
The Integration Process has a mapping step of type XSL that uses an Imported Archive to create the SQL select statement. Then there is a synchronous Send step for the JDBC component
Both this SQL statement and the returned SQL result are available in the XML message monitor SXMB_MONI
Regards,
Mike -
UD Connect Generated SQL Statement
Hi All,
Can anyone tell me if it's possible to influence the generated SQL statement? We need to be able to use the order by clause so as to get the records in the correct order.
Any help much appreciated.
Thanks
CraigHi
Yes its possible in THIS WAY.
CASE-1
In UD Connect we have the DATA in a BASE TABLE. When we execite the under like DATASOURCE (UD-CONNECT). The dependant Info PACK brings the complete data to PSA. After the DATA LANDS in PSA. We can sort out in the same way how can SORT in the SQL Statement method. But to do this you have to PUT a Start routine at infopack level.
Case-2
You have to use a store procedure out side the SAP BI . -
Where to see generated SQL statement from jdbc adapter?
Hi everybody,
where can I see the generated SQL statement from JDBC adapter?
Regards MarioYes and True lterally means the same, but alas XI does not understand literature..
Just checked the note as well, as you are correct!
Regards
Bhavesh -
TopLink does not generate SQL statements for inserting new objects
TopLink does not generate SQL statements for inserting new objects. Why?
Thanks in advance...Please see the response in
Why does not unitofwork.commit write data to the database?
Regards,
Chris -
HI, I am previously a MS Server user. I am so used to the GUI of the Enterprise Manager which could allow to generate table, make SQL statement with drap n drop of a mouse cursor. I wonder if oracle provides anything similar like the MS Server's enterprise manager?
You can use Oracle Enterprise manager to do all the tasks related to database.
Chandar -
FDM-generated SQL statement in log file?
Hello all, hopefully a simple question:
When you perform an import using FDM, I know that behind the scenes a SQL SELECT statement is composed and executed against the database server. My question: is the actual SQL statement kept in a log somewhere (so that we can see it?) In our case it's an Oracle DB server and we're using the ERPI Adapter; not sure if that's relevant. We would like to grab that SQL statement and use it as a jumping-off point for some other things.
Thanks in advance for anything you can offer.The SQL Statement is not written to the log for the adapter. The only things that are logged are what show in the adapter log file if you enable loggin for the ERPi source adapter in the "Get Data" action.
-
How to dynamically execute generated SQL statements using 11gR2 ?
Hello,
I'd like to know if it is possible to do what the following statement intended to do:
select * from (select replace('select empno from emp',
'') from dual);in other words, is it possible to dynamically generate and execute a select statement in a from clause ?
thank you for your help,
John
Edited by: 440bx on Jul 16, 2010 3:57 PM changed "generate" to "generated" in subjectHello Aketi,
That is totally WICKED !!
I've been playing with the code you posted, pretty much since you did, trying to figure out how it works. I have some idea of how it works now but, I cannot figure out why I get the set of results, not once but TWICE.
When I run the query you posted above, this is what I get:
SQL> @getxml2
TABLE_NAME count
CLOB_EXAMPLE 1
D42 1
DEPT 4
DEPT_2 0
DEPT_ACCIDENTS 6
DEPT_EAST 2
... some tables deleted to shorten the output
T1 1
T10 10
T100 0
22 rows selected.
TABLE_NAME count
CLOB_EXAMPLE 1
D42 1
DEPT 4
DEPT_2 0
DEPT_ACCIDENTS 6
DEPT_EAST 2
... some tables deleted to shorten the output
T1 1
T10 10
T100 0
22 rows selected.
SQL>The result is shown TWICE. I cannot figure out why. Any ideas as to why the result is shown twice ? (I ran the statement from SQL*Plus and started a fresh instance of SQL*Plus to ensure that no settings from previous scripts would be the cause).
Thank you for your help, great little piece of code!
John.
Edited by: 440bx on Jul 16, 2010 5:30 PM
Edited by: 440bx on Jul 16, 2010 5:31 PM - corrected name in Hello greeting
Edited by: 440bx - 11gR2 on Jul 17, 2010 2:55 AM - corrected misspelling
Edited by: 440bx - 11gR2 on Jul 17, 2010 2:56 AM - corrected another misspelling -
Cant Add OCRD.CardName,CRD7.ECCNo to this query.Please Help.
declare @FDate as datetime
declare @TDate as datetime
declare @Location as VARCHAR (30)
/* SELECT FROM [dbo].[OLCT] S0 WHERE */ SET @Location = /* S0.Location*/ '[%0]'
/* SELECT FROM [dbo].[OINM] S1 WHERE */ SET @FDate = /* S1.TaxDate*/ '[%1]'
/* SELECT FROM [dbo].[OINM] S2 WHERE */ SET @TDate = /* S2.TaxDate*/ '[%2]'
SELECT
'Sales'Document,OBTN.DistNumber
,NNM1.SeriesName,OINV.DocNum,OCRD.CardName,CRD7.ECCNo,OINV.DocDate,OITM.SWW [HSN Number],INV1.ItemCode,INV1.Dscription,(ITL1.Quantity*-1) [Quantity]
,OEDR.Name,OBTN.U_EDuty*(ITL1.Quantity*-1) EDuty,OBTN.U_EDuty EDutyUnit,OBTN.U_EDCess*(ITL1.Quantity*-1) EDCess,OBTN.U_EDHSCess*(ITL1.Quantity*-1) EDHSCess
,OBTN.U_EDImpDuty SADUnit,OBTN.U_EDImpDuty*(ITL1.Quantity*-1) SADTotal
,OBTN.U_MfgName,OBTN.U_MfgInvNo,OBTN.U_MfgInvDt,OBTN.U_MfgQty,OBTN.U_MfgValue
,OBTN.U_MfgDuty,OBTN.U_MfgCess,OBTN.U_MfgHSCess,OBTN.U_MfgImport
,OBTN.U_SupName,OBTN.U_SupInvNo,OBTN.U_SupInvDt,OBTN.U_SupQty,OBTN.U_SupValue
,OBTN.U_SupDuty,OBTN.U_SupCess,OBTN.U_SupHSCess,OBTN.U_SupImport
FROM
INV1
INNER JOIN
OINV ON INV1.DocEntry=OINV.DocEntry
INNER JOIN
OCRD ON OINV.CardCode = OCRD.CardCode
INNER JOIN
CRD7 ON OCRD.CardCode = CRD7.CardCode
INNER JOIN
OITM ON INV1.ItemCode=OITM.ItemCode
INNER JOIN
OITL ON INV1.BaseType=OITL.ApplyType AND INV1.BaseEntry=OITL.ApplyEntry AND INV1.BaseLine=OITL.ApplyLine
INNER JOIN
ITL1 ON OITL.LogEntry=ITL1.LogEntry
INNER JOIN
OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry and ITL1.SysNumber=OBTN.SysNumber AND ITL1.ItemCode=OBTN.Itemcode
INNER JOIN
[@OEDR] OEDR ON OBTN.U_EDRate=OEDR.Code
LEFT JOIN
NNM1 ON OINV.Series=NNM1.Series
WHERE INV1.LocCode IN (SELECT Code FROM OLCT WHERE Location=@Location)
AND OINV.DocDate BETWEEN @FDate AND @TDate
UNION ALL
SELECT
'Sales Return'Document,OBTN.DistNumber
,NNM1.SeriesName,ORIN.DocNum,ORIN.DocDate,OITM.SWW [HSN Number],RIN1.ItemCode,RIN1.Dscription,(ITL1.Quantity*-1) [Quantity]
,OEDR.Name,OBTN.U_EDuty*(ITL1.Quantity*-1) EDuty,OBTN.U_EDuty EDutyUnit,OBTN.U_EDCess*(ITL1.Quantity*-1) EDCess,OBTN.U_EDHSCess*(ITL1.Quantity*-1) EDHSCess
,OBTN.U_EDImpDuty SADUnit,OBTN.U_EDImpDuty*(ITL1.Quantity*-1) SADTotal
,OBTN.U_MfgName,OBTN.U_MfgInvNo,OBTN.U_MfgInvDt,OBTN.U_MfgQty,OBTN.U_MfgValue
,OBTN.U_MfgDuty,OBTN.U_MfgCess,OBTN.U_MfgHSCess,OBTN.U_MfgImport
,OBTN.U_SupName,OBTN.U_SupInvNo,OBTN.U_SupInvDt,OBTN.U_SupQty,OBTN.U_SupValue
,OBTN.U_SupDuty,OBTN.U_SupCess,OBTN.U_SupHSCess,OBTN.U_SupImport
FROM
RIN1
INNER JOIN
ORIN ON RIN1.DocEntry=ORIN.DocEntry
INNER JOIN
OITM ON RIN1.ItemCode=OITM.ItemCode
INNER JOIN
OITL ON RIN1.BaseType=OITL.ApplyType AND RIN1.BaseEntry=OITL.ApplyEntry AND RIN1.BaseLine=OITL.ApplyLine
INNER JOIN
ITL1 ON OITL.LogEntry=ITL1.LogEntry
INNER JOIN
OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry and ITL1.SysNumber=OBTN.SysNumber AND ITL1.ItemCode=OBTN.Itemcode
INNER JOIN
[@OEDR] OEDR ON OBTN.U_EDRate=OEDR.Code
LEFT JOIN
NNM1 ON ORIN.Series=NNM1.Series
WHERE RIN1.LocCode IN (SELECT Code FROM OLCT WHERE Location=@Location)
AND ORIN.DocDate BETWEEN @FDate AND @TDateNagarajan,
I've altered the query into this.Think that it is working.Thanks man
declare @FDate as datetime
declare @TDate as datetime
declare @Location as VARCHAR (30)
/* SELECT FROM [dbo].[OLCT] S0 WHERE */ SET @Location = /* S0.Location*/ '[%0]'
/* SELECT FROM [dbo].[OINM] S1 WHERE */ SET @FDate = /* S1.TaxDate*/ '[%1]'
/* SELECT FROM [dbo].[OINM] S2 WHERE */ SET @TDate = /* S2.TaxDate*/ '[%2]'
SELECT
'Sales'Document,OBTN.DistNumber
,NNM1.SeriesName,OINV.DocNum,OCRD.CardName,CRD7.ECCNo,OINV.DocDate,OITM.SWW [HSN Number],INV1.ItemCode,INV1.Dscription,(ITL1.Quantity*-1) [Quantity]
,OEDR.Name,OBTN.U_EDuty*(ITL1.Quantity*-1) EDuty,OBTN.U_EDuty EDutyUnit,OBTN.U_EDCess*(ITL1.Quantity*-1) EDCess,OBTN.U_EDHSCess*(ITL1.Quantity*-1) EDHSCess
,OBTN.U_EDImpDuty SADUnit,OBTN.U_EDImpDuty*(ITL1.Quantity*-1) SADTotal
,OBTN.U_MfgName,OBTN.U_MfgInvNo,OBTN.U_MfgInvDt,OBTN.U_MfgQty,OBTN.U_MfgValue
,OBTN.U_MfgDuty,OBTN.U_MfgCess,OBTN.U_MfgHSCess,OBTN.U_MfgImport
,OBTN.U_SupName,OBTN.U_SupInvNo,OBTN.U_SupInvDt,OBTN.U_SupQty,OBTN.U_SupValue
,OBTN.U_SupDuty,OBTN.U_SupCess,OBTN.U_SupHSCess,OBTN.U_SupImport
FROM
INV1
INNER JOIN
OINV ON INV1.DocEntry=OINV.DocEntry
INNER JOIN
OITM ON INV1.ItemCode=OITM.ItemCode
INNER JOIN
OCRD ON OINV.CardCode = OCRD.CardCode
INNER JOIN
CRD7 ON OCRD.CardCode = CRD7.CardCode
INNER JOIN
OITL ON INV1.BaseType=OITL.ApplyType AND INV1.BaseEntry=OITL.ApplyEntry AND INV1.BaseLine=OITL.ApplyLine
INNER JOIN
ITL1 ON OITL.LogEntry=ITL1.LogEntry
INNER JOIN
OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry and ITL1.SysNumber=OBTN.SysNumber AND ITL1.ItemCode=OBTN.Itemcode
INNER JOIN
[@OEDR] OEDR ON OBTN.U_EDRate=OEDR.Code
LEFT JOIN
NNM1 ON OINV.Series=NNM1.Series
WHERE INV1.LocCode IN (SELECT Code FROM OLCT WHERE Location=@Location)
AND OINV.DocDate BETWEEN @FDate AND @TDate
UNION ALL
SELECT
'Sales Return'Document,OBTN.DistNumber
,NNM1.SeriesName,ORIN.DocNum,OCRD.CardName,CRD7.ECCNo,ORIN.DocDate,OITM.SWW [HSN Number],RIN1.ItemCode,RIN1.Dscription,(ITL1.Quantity*-1) [Quantity]
,OEDR.Name,OBTN.U_EDuty*(ITL1.Quantity*-1) EDuty,OBTN.U_EDuty EDutyUnit,OBTN.U_EDCess*(ITL1.Quantity*-1) EDCess,OBTN.U_EDHSCess*(ITL1.Quantity*-1) EDHSCess
,OBTN.U_EDImpDuty SADUnit,OBTN.U_EDImpDuty*(ITL1.Quantity*-1) SADTotal
,OBTN.U_MfgName,OBTN.U_MfgInvNo,OBTN.U_MfgInvDt,OBTN.U_MfgQty,OBTN.U_MfgValue
,OBTN.U_MfgDuty,OBTN.U_MfgCess,OBTN.U_MfgHSCess,OBTN.U_MfgImport
,OBTN.U_SupName,OBTN.U_SupInvNo,OBTN.U_SupInvDt,OBTN.U_SupQty,OBTN.U_SupValue
,OBTN.U_SupDuty,OBTN.U_SupCess,OBTN.U_SupHSCess,OBTN.U_SupImport
FROM
RIN1
INNER JOIN
ORIN ON RIN1.DocEntry=ORIN.DocEntry
INNER JOIN
OCRD ON ORIN.CardCode = OCRD.CardCode
INNER JOIN
CRD7 ON OCRD.CardCode = CRD7.CardCode
INNER JOIN
OITM ON RIN1.ItemCode=OITM.ItemCode
INNER JOIN
OITL ON RIN1.BaseType=OITL.ApplyType AND RIN1.BaseEntry=OITL.ApplyEntry AND RIN1.BaseLine=OITL.ApplyLine
INNER JOIN
ITL1 ON OITL.LogEntry=ITL1.LogEntry
INNER JOIN
OBTN ON ITL1.MdAbsEntry=OBTN.AbsEntry and ITL1.SysNumber=OBTN.SysNumber AND ITL1.ItemCode=OBTN.Itemcode
INNER JOIN
[@OEDR] OEDR ON OBTN.U_EDRate=OEDR.Code
LEFT JOIN
NNM1 ON ORIN.Series=NNM1.Series
WHERE RIN1.LocCode IN (SELECT Code FROM OLCT WHERE Location=@Location)
AND ORIN.DocDate BETWEEN @FDate AND @TDate -
Toplink generate the SQL statement correctly but it does not return any row
Hi
I faced an strange problem when using Toplink as JPA provider. Following snippet shows how I create and execute a query using Toplink JPA:
q = em.createQuery("SELECT B FROM Branch B WHERE B.street LIKE :street");
q.setParameter("street", "'%a%'");
List<Branch> l = q.getResultList();
System.out.println("List Size: " + l.size());The SQL statement resulted by this query is as follow (according to the generated log file)
SELECT ID, STREET FROM BRANCH WHERE (STREET LIKE CAST (? AS VARCHAR(32672) ))
bind => [%a%]Problem is that List size is always 0, independent of what I provide as parameter. I tried and executed the generated SQL statement in the SQL manager and I got some tens of record as the result. The SQL statement i tested in the SQL manager is like:
SELECT ID, STREET FROM BRANCH WHERE (STREET LIKE CAST ('%a%' AS VARCHAR(32672) ))Can someone please let me know what I am missing and how I can fix this problem?
Thanks.Hi,
Thank you for reply.
All data are stored in lower case so, the case sensitivity is not a problem. I am wondering how the generated query works fine when I execute it in the sql manager but it return no result when it is executed by the JPA.
Thanks for looking into my problem. -
Sql statement generator for java.
Is there a (api's ) tool which generates sql statements given a database table, which can be embeeded into the application.
Dear Anand,
Try this one:
CASE balance WHEN 0 THEN 'Completed' ELSE CASE WHEN DATEDIFF(DD, EndDate, GetDate()) >= 0 THEN 'Progress' ELSE 'Pending' END END
I have assumed you don't have negative balance. It that is not true, give me the complete case.
Thanks,
Gordon
Thanks,
Gordon -
SQl statement cause extreme Portal log growth
Our Portal server log file is growing very fast (30 - 50 Mb per minute). When examining the log file we see that the log file does contain only the error messages:
#1.5#00096BF521750058005A9CA900001E480003E80BD8A2C263#1099562506968#/System/Database/sql/jdbc/common#sap.com/irj#com.sap.sql.jdbc.common.StatementAnalyzerImpl#Guest#18####655e44612e4811d9b41300096bf52175#Thread[ThreadPool-Dispatcher,5,SAPEngine_Application_Thread[impl:3]_Group]##0#0#Error#1#com.sap.sql.jdbc.common.StatementAnalyzerImpl#Java#com.sap.sql.jdbc.common_1123#com.sap.sql.log.OpenSQLResourceBundle#The SQL statement "" contains the semantics error[s]: #2#SELECT MIN("ID"),"PRIORITY" FROM "KMC_TQ_QUEUE" WHERE "NAMESPACE_HASH" = ? AND "NAMESPACE" = ? AND "TASK_STATE" = 1 GROUP BY "PRIORITY" ORDER BY 2 DESC#type check error: the expression >>"NAMESPACE"<< (LONGVARCHAR) is not comparable and must not be used with "="
This message occurs more than 500 times per log file. It has something to do with Knowledge management, but we cannot find anything that triggers this sql statement.
Any ideas?
Noel Hendrikx & Pascal RijnartSAP tells us in reaction to our customer message:
"The table's definition is correct. What has to be changed is the
computed type for field NAMESPACE and the generated file for the table.
As I wrote before, if you make any change in the field NAMESPACE the
new computation is started (so change the description which has no
effect on the table's version on the database). Make the change and
save the table in the SapNetWeaver Developer Studio. You will then
see that the field's JDBC-type changes to VARCHAR.
Choose 'Create archive' for Dictionary Project the table belongs to
and deploy the sda on the database. Both can be done in the studio."
Can anyone tell us what to do now?
Noel Hendrikx -
DBIF_RSQL_INVALID_RSQL The maximum size of an SQL statement was exceeded
Dear,
I would appreciate a helping hand
I have a problem with a dump I could not find any note that I can help solve the problem.
A dump is appearing at various consultants which indicates the following.
>>> SELECT * FROM KNA1 "client specified
559 APPENDING TABLE IKNA1
560 UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER
ST22
What happened?
Error in the ABAP Application Program
The current ABAP program "/1BCDWB/DBKNA1" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught
and
therefore caused a runtime error.
The reason for the exception is:
The SQL statement generated from the SAP Open SQL statement violates a
restriction imposed by the underlying database system of the ABAP
system.
Possible error causes:
o The maximum size of an SQL statement was exceeded.
o The statement contains too many input variables.
o The input data requires more space than is available.
o ...
You can generally find details in the system log (SM21) and in the
developer trace of the relevant work process (ST11).
In the case of an error, current restrictions are frequently displayed
in the developer trace.
SQL sentence
550 if not %_l_lines is initial.
551 %_TAB2[] = %_tab2_field[].
552 endif.
553 endif.
554 ENDIF.
555 CASE ACTION.
556 WHEN 'ANZE'.
557 try.
>>> SELECT * FROM KNA1 "client specified
559 APPENDING TABLE IKNA1
560 UP TO RSEUMOD-TBMAXSEL ROWS BYPASSING BUFFER
561 WHERE KUNNR IN I1
562 AND NAME1 IN I2
563 AND ANRED IN I3
564 AND ERDAT IN I4
565 AND ERNAM IN I5
566 AND KTOKD IN I6
567 AND STCD1 IN I7
568 AND VBUND IN I8
569 AND J_3GETYP IN I9
570 AND J_3GAGDUMI IN I10
571 AND KOKRS IN I11.
572
573 CATCH CX_SY_DYNAMIC_OSQL_SEMANTICS INTO xref.
574 IF xref->kernel_errid = 'SAPSQL_ESCAPE_WITH_POOLTABLE'.
575 message i412(mo).
576 exit.
577 ELSE.
wp trace:
D *** ERROR => dySaveDataBindingValue: Abap-Field= >TEXT-SYS< not found [dypbdatab.c 510]
D *** ERROR => dySaveDataBindingEntry: dySaveDataBindingValue() Rc=-1 Reference= >TEXT-SYS< [dypbdatab.c 430]
D *** ERROR => dySaveDataBinding: dySaveDataBindingEntry() Rc= -1 Reference=>TEXT-SYS< [dypbdatab.c 137]
Y *** ERROR => dyPbSaveDataBindingForField: dySaveDataBinding() Rc= 1 [dypropbag.c 641]
Y *** ERROR => ... Dynpro-Field= >DISPLAY_SY_SUBRC_TEXT< [dypropbag.c 642]
Y *** ERROR => ... Dynpro= >SAPLSTPDA_CARRIER< >0700< [dypropbag.c 643]
D *** ERROR => dySaveDataBindingValue: Abap-Field= >TEXT-SYS< not found [dypbdatab.c 510]
D *** ERROR => dySaveDataBindingEntry: dySaveDataBindingValue() Rc=-1 Reference= >TEXT-SYS< [dypbdatab.c 430]
D *** ERROR => dySaveDataBinding: dySaveDataBindingEntry() Rc= -1 Reference=>TEXT-SYS< [dypbdatab.c 137]
Y *** ERROR => dyPbSaveDataBindingForField: dySaveDataBinding() Rc= 1 [dypropbag.c 641]
Y *** ERROR => ... Dynpro-Field= >DISPLAY_FREE_VAR_TEXT< [dypropbag.c 642]
Y *** ERROR => ... Dynpro= >SAPLSTPDA_CARRIER< >0700< [dypropbag.c 643]
I thank you in advance
If you require other information please requestHi,
Under certain conditions, an Open SQL statement with range tables can be reformulated into a FOR ALL ENTRIES statement:
DESCRIBE TABLE range_tab LINES lines.
IF lines EQ 0.
[SELECT for blank range_tab]
ELSE.
SELECT .. FOR ALL ENTRIES IN range_tab ..
WHERE .. f EQ range_tab-LOW ...
ENDSELECT.
ENDF.
Since FOR ALL ENTRIES statements are automatically converted in accordance with the database restrictions, this solution is always met by means of a choice if the following requirements are fulfilled:
1. The statement operates on transparent tables, on database views or on a projection view on a transparent table.
2. The requirement on the range table is not negated. Moreover, the range table only contains entries with range_tab-SIGN = 'I'
and only one value ever occurs in the field range_tab OPTION.
This value is then used as an operator with operand range_tab-LOW or range_tab-HIGH.In the above example, case 'EQ range_tab-LOW' was the typical case.
3. Duplicates are removed from the result by FOR ALL ENTRIES.This must not falsify the desired result, that is, the previous Open SQL statement can be written as SELECT DISTINCT.
For the reformulation, if the range table is empty it must be handled in a different way:with FOR ALL ENTRIES, all the records would be selected here while this applies for the original query only if the WHERE clause consisted of the 'f IN range_tab' condition.
FOR ALL ENTRIES should also be used if the Open SQL statement contains several range tables.Then (probably) the most extensive of the range tables which fill the second condition is chosen as a FOR ALL ENTRIES table.
OR
What you could do in your code is,
prior to querying;
since your select options parameter is ultimately an internal range table,
1. split the select-option values into a group of say 3000 based on your limit,
2. run your query against each chunck of 3000 parameters,
3. then put together the results of each chunk.
For further reading, you might want to have a look at the Note# 13607 as the first suggestion is what I read from the note. -
Generated SQL does not have fully qualified columnnames
Hi,
I'm trying to run a JDO query which results in:
[code=-5001, state=42703]
java.sql.SQLException: [SQL5001] Column qualifier or table CUSTOMER
undefined.
The model is basically like this:
Class Order has a 1-1 relation with Class CustomerRole which in turn has a
n-1 relation with Class Customer
Class Order and CustomerRole are both mapped to table SCHEMA1.ORDER (the
ORDER table contains the FK to the CUSTOMER table)
Class Customer is mapped to table SCHEMA2.CUSTOMER
I perform a query using an Extend of class Order.
I add the following filter to the query:
"this.CustomerRole.Customer != null"
(CustomerRole is the name of the relation between Order and CustomerRole,
while Customer is the name of the relation between CustomerRole and
Customer)
When I execute this query, I get the following message:
kodo.util.DataStoreException: [SQL5001] Column qualifier or table CUSTOMER
undefined. {SELECT t0.ID, t2.CUSTID, t3.ADDRESS, t4.COUNTRY,
t4.COUNTRYNAME, t2.NAME FROM SCHEMA1.ORDER t0 INNER JOIN SCHEMA1.ORDER t1
ON t0.ID = t1.ID LEFT OUTER JOIN SCHEMA2.CUSTOMER t2 ON t1.CUSTID =
t2.CUSTID LEFT OUTER JOIN SCHEMA2.CUSTOMER t3 ON t2.CUSTID = t3.CUSTID
LEFT OUTER JOIN SCHEMA1.COUNTRY t4 ON t3.COUNTRY = t4.COUNTRY WHERE (0 <
(SELECT COUNT(*) FROM SCHEMA2.CUSTOMER WHERE CUSTOMER.CUSTID =
t1.CUSTID))} [code=-5001, state=42703]
NestedThrowables:
com.solarmetric.jdbc.ReportingSQLException: [SQL5001] Column qualifier or
table CUSTOMER undefined. {SELECT t0.ID, t2.CUSTID, t3.ADDRESS,
t4.COUNTRY, t4.COUNTRYNAME, t2.NAME FROM SCHEMA1.ORDER t0 INNER JOIN
SCHEMA1.ORDER t1 ON t0.ID = t1.ID LEFT OUTER JOIN SCHEMA2.CUSTOMER t2 ON
t1.CUSTID = t2.CUSTID LEFT OUTER JOIN SCHEMA2.CUSTOMER t3 ON t2.CUSTID =
t3.CUSTID LEFT OUTER JOIN SCHEMA1.COUNTRY t4 ON t3.COUNTRY = t4.COUNTRY
WHERE (0 < (SELECT COUNT(*) FROM SCHEMA2.CUSTOMER WHERE CUSTOMER.CUSTID =
t1.CUSTID))} [code=-5001, state=42703]
java.sql.SQLException: [SQL5001] Column qualifier or table CUSTOMER
undefined.
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:63)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:51)
at
kodo.jdbc.runtime.AbstractSelectResultObjectProvider.handleCheckedException(AbstractSelectResultObjectProvider.java:150)
at com.solarmetric.rop.WindowResultList.<init>(WindowResultList.java:57)
at
kodo.jdbc.runtime.JDBCFetchConfigurationImpl.newResultList(JDBCFetchConfigurationImpl.java:135)
at
kodo.runtime.CopyOnWriteFetchConfiguration.newResultList(CopyOnWriteFetchConfiguration.java:159)
at kodo.query.AbstractQuery.executeWithMap(AbstractQuery.java:750)
at kodo.query.AbstractQuery.execute(AbstractQuery.java:633)
at TestApp.<init>(TestApp.java:67)
at TestApp.main(TestApp.java:135)
The problem is the last part of the query where it selects from
SCHEMA2.CUSTOMER while the Where part refers to just CUSTOMER (without
schema qualifier).
Are there any ideas to solve this? Is there a way to force columnnames
always being fully qualified in generated SQL statements?
Thanks,
Regards,
AlexanderUnfortunately, this is a bug that has to be fixed on our end. We'll
make sure a fix is in the next 3.1 release. Thanks for the report!
Maybe you are looking for
-
Black boot screen and startup manager on mid 2014 rMBP after upgrading to Yosemite
After upgrading to Yosemite I'm experiencing black booting process. Moreover, I noticed that the startup manager, which we access by holding the option key, has the black background too. I didn't like the Yosemite, so I downgraded back to Mavericks,
-
Filter Function problems on ALV report. [Resolved]
Hi, I developed an ALV report by using function as below: CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = G_REPID * I_CALLBACK_PF_STATUS_SET = status_set * I_CALLBACK_USER_COMMAND =
-
I have two phones under the same apple ID and I want to put them on separate apple IDs, how do I do this??
-
Ipod cannot restore"because files are being used by another application"
Hello all, I hope someone can help me. I think I mad a big mistake. I did a favor for my father who bought the newest IPod clip on shuffle for my mom. I agreed to get it up and running using my laptop, (which has Itunes for my Ipod w/video) would thi
-
Hi All, Please have a look in to the below mentioned environment. primary site :SITE 1 server 1 server 2 secondary site :SITE 2 server 3 Note : All the above three servers are in single DAG .All the database are mounted on the server (server 1) whi