All queries in an SQL statement containing a UNION operator must have an equal number of expressions in their target lists.
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 @TDate
Nagarajan,
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
Similar Messages
-
Regular expression for recognizing all tables in a sql statement
Hi all
I need a regular expression for recognizing all the tables bane in a geberic statement.
Unlikely i need a regular expression that manage also inner join .I 'm sorry but this matter is new for me and i cannot find any usefull help in the web.
RegardsIf you insist it should be something like:
"SELECT ([A-Z0-9_]+)[.][A-Z0-9_]+(,([A-Z0-9_]+)[.][A-Z0-9_]+)* FROM (([A-Z0-9_]+)[.][A-Z0-9_]+) INNER JOIN (([A-Z0-9_]+)[.][A-Z0-9_]+) ON .+" plus spaces etc... Yes it's for this kind of statements only.
But SQL parser is better because anyway you'll need to at least remove duplicates from founded names... -
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? -
The 3 apps required updating but they have frozen. Did not realise this until Candy Crush froze. Went to reset and it asked for pass code. I entered standard code and it stated one failed attempt. I may be over 70 years of age but have not forgotten pass code!! I hope that the solution is simple!!
If your iPad was used by another person in the past, it may be asking for their passcode.
If your iPad has been synced with a computer before, restoring with your computer should fix it now.
Read all directions.
Per these directions...
http://support.apple.com/kb/HT1212 -
Hello!
I need some correction in the following query. I am trying to make a 2 page QPLD so I am joining 2 queries and then printing the report into 2 pages.
SELECT T0.[U_OANumber], T0.[custmrName], T0.[U_Inspection], T0.[U_Cust_PO_Num],
T0.[U_ModelType], T0.[U_Duty], T0.[U_NamePlate],
T0.[U_Indicator_Obs], T0.[U_Fastners], T0.[U_Mounting_Type], T0.[U_Casing_Orientation], T0.[U_Impeller_Dia],
T0.[U_Bearing_Style], T0.[U_Motor_HP_Size], T0.[U_InsulationWedges], T0.[U_Varnish], T0.[U_Paint_Shade],
T0.[U_PlugsSeal], T0.[U_Remarks], T0.[U_Despatch]
FROM OINS T0 WHERE T0.[U_OANumber] = '[%0]' or T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
Union all
SELECT T0.[U_ModelType], T0.[U_Size], T0.[U_Discharge], T0.[U_Head], T0.[U_RPM], T0.[U_YOM], T0.[U_HP],
T0.[U_Amps], T0.[U_Insulation_Class], T0.[U_Winding_Connection]
FROM OINS T0 WHERE
T0.[U_OANumber] = '[%0]' or T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
Do I have to use the where clause just once since it is identical to both statements?
I get the error stating that all queries using Union, Intersect or Except must have an equal number of expressions. what does this mean?
scorp
Edited by: scorpion 666 on Feb 12, 2009 1:30 PMUnion has to have exact same numbers of fields to combine two results. Your query shows no need of union because your where clauses are identical.
Right syntax would be like this:
SELECT T0.[U_OANumber], T0.[custmrName], T0.[U_Inspection], T0.[U_Cust_PO_Num],
T0.[U_ModelType], T0.[U_Duty], T0.[U_NamePlate],
T0.[U_Indicator_Obs], T0.[U_Fastners], T0.[U_Mounting_Type], T0.[U_Casing_Orientation], T0.[U_Impeller_Dia],
T0.[U_Bearing_Style], T0.[U_Motor_HP_Size], T0.[U_InsulationWedges], T0.[U_Varnish], T0.[U_Paint_Shade],
T0.[U_PlugsSeal], T0.[U_Remarks], T0.[U_Despatch], T0.[U_Size], T0.[U_Discharge], T0.[U_Head], T0.[U_RPM], T0.[U_YOM], T0.[U_HP],
T0.[U_Amps], T0.[U_Insulation_Class], T0.[U_Winding_Connection]
FROM DBO.OINS T0 WHERE T0.[U_OANumber] = '[%0]' or T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
Thanks,
Gordon -
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. -
If someone would be so kind, I need help in formulating a SQL statement.
Table A - employees(empoyee_id, employee_name, status)
This table contains all employees
employee status can be one of three values (A=active, T=temporary, I=inactive)
Table B - savings_program(employee_id, plan_type)
This table only has employee_id's of those that participate in a savings program (subset of all employees).
plan_type can be one of three numeric values (30,35,40)
I need SQL to report a.employee_id,a.employee_name,b.plan_type (return plan_type 30,35, or none)of all active employees in Table A that don't participate in Table B plan_type 40.
Working with version 9iR2. Thanks!
Edited by: fosterk on Nov 21, 2008 12:59 PMThe tables and columns above were for demo purposes but actual code I'm trying is below. Please excuse me I'm more of an SA type so SQL is not my thing.
As you can see from the first SQL statement below I know that I have exactly
3,000 employees that meet this criteria. The second SQL statement is my attempt to return the rows I want (I'm just nesting it in a count(*) until the numbers look right)
The last statement is what was given to me by someone else (seeking my help haha) trying to resolve it and it only returns 3 rows. This SQL shows the actual columns that we're trying to return from both tables.
HR> select count(*) from ps_All_employees where empl_status != 'T'
2 and emplid not in
3 (select emplid from ps_savings_pt_vw where plan_type = 40)
4 /
COUNT(*)
3000
HR> select count(*) from (
2 (select * from ps_all_employees where empl_status != 'T') a left outer join
3 (select emplid from ps_savings_pt_vw where plan_type != 40) s
4 on a.emplid = s.emplid
5 )
6 /
COUNT(*)
4587
select count(*) from (
select a.location, a.ssn, a.first_name, a.last_name, a.birthdate, a.orig_hire_dt, a.hire_dt, a.location, a.street1,
a.street2, a.city, a.state, a.zip, s.plan_type
from ps_all_employees a, ps_savings_pt_vw s
where a.empl_status != 'T' and
a.emplid = s.emplid and
a.emplid not in (select s.emplid from ps_savings_pt_vw s where s.plan_type = 40)
COUNT(*)
3 -
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 -
How to use Native SQL statement in JDBC receiver interface
Dear All,
Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
Select Field1 Field2 from TABLE Where Field3 like "%Name'
I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
Hence I need to know:-
1. What message mapping I should use in case if I have to use Native SQL statement.
2.What operation mapping I should use in case if I have to use Native SQL statement.
If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
3 .How do to go about it to do the Java mapping.
Thanks
Ameet>
Ameet Deshpande wrote:
> Dear All,
>
> Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
>
> "
> Select Field1 Field2 from TABLE Where Field3 like "%Name'
> "
> I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
>
> http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
> http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
>
> The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
>
> Hence I need to know:-
>
> 1. What message mapping I should use in case if I have to use Native SQL statement.
> 2.What operation mapping I should use in case if I have to use Native SQL statement.
> If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
> 3 .How do to go about it to do the Java mapping.
>
> Thanks
> Ameet
You can use a stored procedure, and call it from jdbc receiver adapter.
I also solve this issue, with a DBLookup in message mapping. You can refer to my blog, and this usefull 3d:
http://simonlesflex.wordpress.com/2010/12/07/pi-oracle-dblookup/
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler -
Trying to find a specific SQL statement to determine its cost
If an sql statement is executed will it ALWAYS show up in the awrrpt report? (10g)
I am a developer DBA and was handed an SQL statement by the production DBA as being a problem during a specific timeframe within the past hour.
That statement does not show up in v$LongOps (although other older ones are) nor does it appear in v$sqltext and is not in the awrrpt even when I run the report for the entire day.
Any other ideas or can I safely broach the Production DBA without looking like an idiot?!!
ThanksI am not using awrrpt report but for sure if your statement has been executed it must have been in v$sqltext but maybe it did not stay very long because it has been rarely executed and replaced in the shared pool by other SQL statements that have been more executed.
You could setup a copy of your production database on a similar host and run the statement several time in single user mode to check at least its performance in single user with sql_trace=TRUE and tkprof.
If your statement is SELECT your could also execute it in your production database and check at the sametime v$sqltext and also v$sqlarea, especially for:
DISK_READS NUMBER Sum of the number of disk reads over all child cursors
BUFFER_GETS NUMBER Sum of buffer gets over all child cursors
USER_IO_WAIT_TIME NUMBER User I/O Wait Time (in microseconds)
CPU_TIME NUMBER CPU time (in microseconds) used by this cursor for parsing, executing, and fetching
ELAPSED_TIME NUMBER Elapsed time (in microseconds) used by this cursor for parsing, executing, and fetching -
Hello All!
Please help me how I can put in SQL statement string.
For now, I have in data in field 9985. I need 99.85.
Thank you in advance.Hi,
In general, where do you want the '.' to go?
After the first 2 characters?
Before the last 2 characters?
Directly in the middle (if possible)?
Something else?
This expression adds a '.' before the last 2 charachters:
REGEXP_REPLACE ( s,
, '(..$)' -- '.' means "any character" here
, '.\1' -- '.' has no special meaning here
)If s is only 1 character long, the expression above will not add a '.'. -
SQL Statement / Count & Percentage
Hello All,
Below is the SQL statement that I'm using with an MS Access database. Now, I'm looking for an SQL statement that will get the same results using an SQL Compact database.
Here is what I am using with MS Access that works great:
queryString = "SELECT DStatus, Count(DStatus) As CountOfSummaryItem, (Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage From tbl_Records_DR GROUP BY DStatus Order BY Count(DStatus) DESC;"
Results are something like this out of a total 50 records in the database:
Status - Count - Percentage
Broken - 5 - 10%
Stopped - 10 - 20%
Return - 20 - 40%
Closed - 15 - 30%
Thanks,
ADawn
ADawnSQL Server Compact has limited support for subqueries. I would suggest:
SELECT DStatus, Count(*) FROM tbl_Records_DR GROUP BY DStatus
to get the record count per "DStatus", and load the results on a generic List<> object, where you would do the math in code, or else, get first the total record count into a int variable, executing a scalar command with the following instruction
(C#):
SqlCeCommand totalCountCommand = new SqlCeCommand("SELECT Count(*) FROM tbl_Records_DR", myConnection);int i = (int)totalCountCommand.ExecuteScalar();
...and then use that value on the following instruction, either using string concatenation or a command parameter to divide each value fot the total count...
SqlCeCommand rowCountCommand = new SqlCeCommand("SELECT DStatus, Count(*), Count(*)/" + i.ToString() + " * 100 AS Percentage FROM tbl_Records_DR GROUP BY DStatus", myConnection);SqlCeDataReader r = rowCountCommand.ExecuteReader();
This is not tested code, it's just meant to give you an idea on how to get the result.
Alberto Silva Microsoft MVP - Device Application Development - http://msmvps.com/AlbertoSilva moving2u - R&D Manager - http://www.moving2u.pt -
How to audit alter user sql statements in Oracle 11g.
I want to audit all the alter user sql statements that show who is altered with what sql stment including the connections performed by sys and system.
Ex: If I use the command : alter user xxx quota 50 GB on users;
Then how can i grab this sql stement and who performed it with the timings.Pl post OS and database versions.
What have you learned from the documentation ?
http://download.oracle.com/docs/cd/E11882_01/server.112/e26088/statements_4007.htm#SQLRF01107
http://download.oracle.com/docs/cd/E11882_01/network.112/e16543/guidelines.htm#DBSEG508
What have you tried to implement so far ?
HTH
Srini -
Need help for the sql statement !!!!!
hi all,
i need a sql statement for a query, how can i get the result from the rownum between 100 and 150?
plz helpuse a scrollable statement:
PreparedStatement stat = Connection.prepareStement("select * from blah", ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stat.executeQuery();
rs.absolute(100);
while (rs.next()) {
String something = rs.get(1);
Look into the JDK API reference for ResultSet to get an expalantion of scrollable statements. -
Hi,
Need help to write sql statement.
create table t_dt ( dt_start date, dt_end date, amount number);
insert into t_dt values('1-Jan-10','10-Feb-10',12);
insert into t_dt values('11-Feb-10','10-Mar-10',10);
insert into t_dt values('11-Mar-10','20-Apr-10',8);
insert into t_dt values('21-Apr-10','28-Jun-10',10);
insert into t_dt values('29-Jun-10','20-Sep-10',10);
insert into t_dt values('21-Sep-10','10-Oct-10',10);
insert into t_dt values('11-Oct-10','31-Dec-10',8);
insert into t_dt values('1-Jan-11','10-Feb-11',8);
insert into t_dt values('11-Feb-11','10-Mar-11',7);
insert into t_dt values('11-Mar-11','20-Apr-11',6);
insert into t_dt values('21-Apr-11','28-Jun-11',6);
insert into t_dt values('29-Jun-11','20-Sep-11',6);
insert into t_dt values('21-Sep-11','10-Oct-11',4);
insert into t_dt values('11-Oct-11','31-Dec-11',8);
Result should be like below..
dt_start dt_end Amount
1-Jan-10 10-Feb-10 12
11-Feb-10 10-Mar-10 10
11-Mar-10 20-Apr-10 8
21-Apr-10 10-Oct-10 10
11-Oct-10 10-Feb-11 8
11-Feb-11 10-Mar-11 7
11-Mar-11 20-Sep-11 6
21-Sep-11 10-Oct-11 4
11-Oct-11 31-Dec-11 8
Just to explain the example, take a row with start date as 21-Apr-10 in the above insert statements, since it has the same amount for next two rows (i.e. with start date '29-Jun-10' and '21-Sep-10') these 3 rows should be converted to represent only 1 row in the result and the start date and end date should be changed per the result shown above.
Thanks.Hello
I think this gives yuo what you need....
SELECT
MIN(dt_start),
MAX(dt_end),
amount
FROM
( SELECT
dt_start,
dt_end,
MAX(marker) OVER(ORDER BY dt_start) marker,
amount
FROM
Select
dt_start,
dt_end,
amount,
CASE
WHEN LAG(amount) OVER(ORDER BY dt_start) <> amount THEN
ROW_NUMBER() OVER(ORDER BY dt_start)
END marker
from t_dt
GROUP BY
amount,
marker
order by
MIN(dt_start)
MIN(DT_START) MAX(DT_END) AMOUNT
01-JAN-2010 00:00:00 10-FEB-2010 00:00:00 12
11-FEB-2010 00:00:00 10-MAR-2010 00:00:00 10
11-MAR-2010 00:00:00 20-APR-2010 00:00:00 8
21-APR-2010 00:00:00 10-OCT-2010 00:00:00 10
11-OCT-2010 00:00:00 10-FEB-2011 00:00:00 8
11-FEB-2011 00:00:00 10-MAR-2011 00:00:00 7
11-MAR-2011 00:00:00 20-SEP-2011 00:00:00 6
21-SEP-2011 00:00:00 10-OCT-2011 00:00:00 4
11-OCT-2011 00:00:00 31-DEC-2011 00:00:00 8
9 rows selected.HTH
David
Edited by: Bravid on Feb 23, 2012 12:08 PM
Beaten to it by Frank! :-)
Maybe you are looking for
-
Looking for a particular 1pad2 case
I am looking for a case for the ipad2. the case must protect the ipad2, without covering up ports and camera. the kicker is, it needs to have a shoulder strap attached in order to be worn around the neck.
-
10g install simply stops at 'Cloning database creation in progress,' part of the Oracle Database configuration assistant phase in the Universal Installer. I cannot see any error outputs, but this phase stops at 45% complete. I tried three times now,
-
I have loaded all my music to the cloud from my hard drive. When I am viewing the music on my PC from the cloud it wasn't displaying all of the song/artist information correctly. I took the time to go into each one that wasn't displaying correctly
-
Restoring new iPhone 4S from iCloud backup has created an app sync nightmare with iTunes
I've restored my new iPhone 4S from iCloud and plugged it into my computer to sync over the apps so they wouldnt have to redownload via iCloud. Hit the initial ok dialogue button, which had an auto-sync apps option checkmarked under it (this was the
-
OWB support for ISO Week number?
Is there any way to get the Time dimension wizard to support the ISO standard for Year and Week numbering (formats IYYYY and IW)? I need to set up a time dimension for our data warehouse and our company uses the ISO Year/Week numbering schemes (see h