Order By clause is ignoring LowerCase field name
I am trying to use a QoQ, but am running into a problem when
using the order by clause...
All the fieldvalues in the order by field start with
uppercase except for one, and this field name gets thrown to the
end of the list
Anyone got any ideas???
thanks
Sujit
Before you try the following, please note that you can clean
this up in your original DB queries -- which is almost always
better.
Anyway, suppose your QofQ was:
SELECT MixcasedColumn
FROM SomeQuerySet
ORDER BY MixcasedColumn
Then you would add a dummy column to use for case-insensitive
sort:
SELECT
MixcasedColumn, UPPER (MixcasedColumn) AS SortColumn
FROM
SomeQuerySet
ORDER BY
SortColumn <!--- Note that upper() is not allowed here
but derived columns are! --->
Similar Messages
-
Order by clause being ignored in region definition?
Hi-
I've created an interactive report on a database table. In this report, i'd like my data to display in a certain order initially, but allow it to be changed, if necessary. My query looks like:
select action_year, action_month, action_count , (and so on)
from my_table
order by action_year, action_month, action_count desc
When the report is displayed, the data does not display sorted in the order specified in my SQL (for the first row returned, i'll see '2007' when i have '2008' data in the table). I'm wondering if the "order by" clause is ignored by the APEX query parser and if so, how can i get my data to display in the manner that i am programmatically after. As far as i know, i've not specified any additional sorts on my report data.
cheers,
jim.If you create a view like this:
CREATE VIEW emp_vu
AS
SELECT ename, empno, job, sal, deptno
FROM emp
ORDER BY deptno, enameand use a select in your interactive report
SELECT *
FROM emp_vuthe data will show initialy as it is supposed to. You are
able to sort on it as you need. The only thing you need to
disable (exclude) is the single link column. Apparently, if this
option is enabled, apex sorts on that link value.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
What balance value in sales order and iwant to know table field name in
where the balance value come in sales order i want make sales order report in which i want to add this filed how we add it and tell me table field name of balance vlue and how we give it in FS please help me in this my report are left without it please give me solution
Hello
where the balance value come in sales order
Please note that when you raise your question at SDN forum, your question needs to be clear...
What do you mean by BALANCE VALUE ????
Regards,
Sarthak -
Sql count function in order by clause
Post Author: krypton
CA Forum: Data Connectivity and SQL
Hi Guys
Can i ask a quick question. I am trying to retrieve data remotely from a SQL Server via crystal reports.
Within the Database Expert I have entered a SQL query to retrive the number of (call center) support calls raised by our customers:-
Select `Primary_Company`, COUNT(`Calls`)From `SPRT_Issue` GROUP BY `Primary_Company`ORDER BY COUNT(`Calls`) desc
The customer's column is called 'Primary Company' and the calls they raise are in the 'Calls' column. the above is a normal sql query.
However Crystal fails to run the query and generates an error message :-
Failed to open a rowset. Details: 420: Driver] Expected lexical element not found: <identifier>
I dont understand why it wont run. In the ORDER BY clause if i replace field 'Calls' by the field 'Primary Company' then it works.
I think the problem is that it wont accept the count function in the order by clause. which is what i want it to do i.e display the calls in descending order by each customer.
Could someone tell me if there is a way around it.
Thanks
KryptonPost Author: krypton
CA Forum: Data Connectivity and SQL
Thanks Lynn
I tried your suggestion. But there is one probelm.
When i sort the data in descending order using the count(calls) field, the data is returned but the customer's name appears multiple times along with their calls raised.
E.g, if customer Mark raised multiple calls i.e. 2, 5, and 10 calls, then the report will show
Mark 2
Mark 5
Mark 10
But is there a way to aggregate all the calls for mark and show them only once:
such as Mark 17
Thanks -
I need to dynamically build the order by clause of my query.
I tried this:
<named-query name="list">
<query>
<![CDATA[
SELECT p FROM Person p
ORDER BY :orderby
]]>
</query>
</named-query>
@SuppressWarnings("unchecked")
public List<Person> list(String sort) {
Query query = getEntityManager().createNamedQuery("list");
query.setParameter("orderby", sort);
return query.getResultList();
}But at runtime it throws an exception:
com.microsoft.sqlserver.jdbc.SQLServerException:
L'elemento SELECT identificato da ORDER BY 1 include una variabile nell'espressione che identifica la posizione di una colonna.
Le variabili sono consentite solo nell'ordinamento in base a un'espressione che fa riferimento a un nome di colonna.The translation of the italian message is something like:
The SELECT element identified by ORDER BY 1 includes a variable that identifies the position of a column.
The valid variables in the order by clause must refer to the name of a columnThe value of the parameter sort is_ the name of a column!
Any hint?My solution was to append the order clause to an "namedQuery" like this:
- declare the named query as usual, with annotation
- create a simple helper function like findNamedQuery to find the query string for a given class and queryName (using reflection)
- if you need to execute the query without sort order - use EntityManager.createNamedQuery (as usual)
- BUT: if you want to sort data: use EntityManager.createQuery with the string obtained from findNamedQuery and the sort clause
I guess the is a performance penalty, but.. .it works. -
Can You please help me out with field names and tables where i can find .
u2022 Buyers Name : From PO. Person ( Customer, Not Joerns) who places the PO.
u2022 Order Number : Stryker Order number [Leave a place holder]
u2022 Order Type : Stryker order type [Leave a place holder]
u2022 REV: Joerns SAP Material revision. Can be found in Material Master.
u2022 FROM: Based on the shipping point. Should be the shipping point address.
u2022 Ship-To: Ship-To address in the sales order
u2022 Shipped Quantity: Handling Unit quantity
u2022 Shipping date : Item Delivery date
u2022 Packing Slip : [Leave a place holder]
u2022 KANBAN ID : [Leave a place holder]
u2022 Team Number : [Leave a place holder]
u2022 Part Number : SAP MATNR
u2022 Part Description : Material Description
u2022 Boxes: handling Unit count number. Say for example, there are 10 HU Labels are printed in this , then the first label should show 1 / 10, second should show 2 / 10, third should show 3 / 10 and goes on till tenth, which should show 10/10.
u2022 PO Number : Purchase order NumberHi..
All these field name you can trace from SE15 transaction.
goto se15-> expand abap dictionary-> expand fields-> double click on table fields-> enter your fields description in the field description tab of beside screen-> click on xcute.
ex: Part description
enter MaterialDescription* and click on xcute , you will get MAKTX from MAKT table.
All the best.
Thanks,
Naveen.I -
Order By Clause with Empty Field values !
Hello,
In Oracle , the order by clause does not return the expected query result, if any of the field value in the order by clause has an empty string.
Oracle treats the empty string as null value and ORDER BY gives a result with the empty string field values listed at last.
For example :
test is a sample table containing "name" field.
Query: "select name from test order by name"
In SQL Server/Access
Result (1)
NAME
(blank)
(blank)
User1
User2
User3
In Oracle
Result (2)
NAME
User1
User2
User3
(blank)
(blank)
I know some of the Work arounds for this as listed below :
1) To use NVL in Order By Clause.
i.e., the modified query
"select name from test order by nvl(name,0)"
gives the result same as Result (1).
2) To have single blank space in the field value if it is empty.
I dont want to use either of these two options b'se it would lead to a mass change in my existing code.
Is there any way i can do a
collation order settings in the Oracle databases to get the results as in MS SQL/Access.
Can Any help me out in Solving this?
Thanks
Devi Shankar
nullBharath,
I am moving this question to the SQL forum.
Regards,
Geoff -
Dual Case Column names fail in select ORDER BY clause
This one is solved, but I thought someone might be able to explain why it happens.
I'm a newbie, since I just downloaded Oracel XE last night, and am trying it out.
I set up a trivial table with 4 text columns. As it happened, I used dual case for some of my column names, such as 'Nickname'.
When trying out the Query Builder, the Select statement failed whenever I added a sort.
After some head scratching and back-and-forth with the sample data base (HR), I finally renamed all the columns to upper case. (e.g. column 'Nickname' became 'NICKNAME'). Then it works.
Seems like a bug, but maybe it's just a feature. Here's the code generated by the Query Builder. As you can see, there are no quotes around the Table name or column names in the ORDER BY clause (and the dual case version of the column name works if I put the quotes in manually and run it with SQL command.) Seems quirky.
select "TEAMS"."NICKNAME" as "NICKNAME",
"TEAMS"."CITY" as "CITY",
"TEAMS"."DIVISION" as "DIVISION",
"TEAMS"."CONFERENCE" as "CONFERENCE"
from "TEAMS" "TEAMS"
order by TEAMS.NICKNAME ASCWelcome to forum. :)
Now, answering your question - no i don't think this is a bug.
It is your code - which create this bug.
Now, question is - what happen?
Just check your select and from clause. You put all the names are in double quote. When you put anything within double quotes - it become a case sensitive. So, the problem occurs there.
Let's see ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:01.11
satyaki>
satyaki>create table s_otn
2 (
3 id number(4)
4 );
Table created.
Elapsed: 00:00:02.14
satyaki>
satyaki>set lin 80
satyaki>
satyaki>desc s_otn;
Name Null? Type
ID NUMBER(4)
satyaki>
satyaki>desc S_OTN;
Name Null? Type
ID NUMBER(4)
satyaki>
satyaki>desc s_OtN;
Name Null? Type
ID NUMBER(4)
satyaki>
satyaki>drop table s_otn;
Table dropped.
Elapsed: 00:00:05.22
satyaki>
satyaki>
satyaki>create table "S_otn"
2 (
3 id number(4)
4 );
Table created.
Elapsed: 00:00:00.12
satyaki>
satyaki>
satyaki>desc S_otn;
ERROR:
ORA-04043: object S_otn does not exist
satyaki>
satyaki>desc S_OTN;
ERROR:
ORA-04043: object S_OTN does not exist
satyaki>
satyaki>desc s_otn;
ERROR:
ORA-04043: object s_otn does not exist
satyaki>
satyaki>desc "S_OTN";
ERROR:
ORA-04043: object "S_OTN" does not exist
satyaki>
satyaki>desc "S_otn";
Name Null? Type
ID NUMBER(4)
satyaki>Got me?
Regards.
Satyaki De. -
Reg:FCC to ignore the last field name
Hi...
I am using FCC in the reciver file adapter.
the output structure is like
94,ESSAR,,,,,,,D,0000100226,10000,12/13/1 KURLA EAST,MUMBAI,,400025,006398765432,,2009-03-24 00:00:00.0,0000100226,20202789,,,,SUCCESS,,
/home/corpuser/Disbursement/DD
I am achieving the above structure. But in that i dont want the last field name "/home/corpuser/Disbursement/DD".
Can you please tell how to ignore the last field name in the receiver file adapter using FCC.
Thanks & Regards,
Leela94,ESSAR,,,,,,,D,0000100226,10000,12/13/1 KURLA EAST,MUMBAI,,400025,006398765432,,2009-03-24 00:00:00.0,0000100226,20202789,,,,SUCCESS,,
/home/corpuser/Disbursement/DD
I am achieving the above structure. But in that i dont want the last field name "/home/corpuser/Disbursement/DD".
Can you please tell how to ignore the last field name in the receiver file adapter using FCC.
Completely with Jai on that.
Dont do that mapping itself. Handle such conditions in your mapping.
Is there any specific reason why you can do so? -
After changing the field name in BM layer, drilldown field is not in order
We have an organization hierarchy region->branch used in our HBD dashboard report. When we drilldown to branch level report by clicking the region field, the result is OK but branch field is not in order. The branch level order was working fine before we changed this BRANCH field name in BM layer from Team/Branch to Branch.
I have confirmed that I know the user who originally posted this to Metalink. This issue is no longer a problem. Rebooting resulted in the order displaying properly.
-
Change All Field Names in a Table to have a Lowercase First Letter
I have an SQL database with many tables. All of the field names in each table start with an Uppercase letter. I would like to programmatically change all of the field names in each table to start with a lowercase letter. Can this be done?
E.g.: "FieldName" to "fieldname"
Thanks.O.K. Just in case anyone else runs into this, I used Carl's answer to guide me in the right direction. This is my final code that created the commands I needed to run a batch (where TMaster is my schema name and the WHERE statement contains
the datatypes in your tables):
SELECT
'EXEC SP_RENAME ''TMaster.'+TABLE_NAME+'.'+COLUMN_NAME+''',
'''+LOWER(SUBSTRING(COLUMN_NAME,1,1))+SUBSTRING(COLUMN_NAME,2,255)
+''',
''COLUMN'''
FROMINFORMATION_SCHEMA.COLUMNS
WHEREDATA_TYPE='int'. -
Why order by clause maintains column number values instead of column names
why order by clause maintains column number values instead of column names ?
we can use oder by 1,2 as column number
UGNo one said that it can't be used. What's your point?
To OP: It can be written with the column's 'select list positional number' just because for the support of laziness. :)
There's no difference between 'ORDER BY name, address' and 'ORDER BY 1,2'. -
I wish to modify the name of one of the field name in the sales order.
HELLO GURRRUS,
i wish to modify teh name of one of the field name in the sales ordder.
what is the procdure,path and steps involved in that.it would be of great help of me if u take some time and suggest me.
bye take care hav a happy and peaceful lifeHi Sameer,
If you want to change the name or description of the field in the Sales order,
you have to use the userexit MV45AFZZ and use the Form USEREXIT_FIELD_MODIFICATION.
Get the help of the ABAPer and decide where do you want to make the change in the Header or the Line items. Accordingly give the requirements to the ABAPer.
He will do it.
Thanks
Augustine Ponraj -
What is table name and field name for balance value in sales order in sap
hi i want to make FS for sales order status report .and i want balance value in report please tell me about table field name of balance value.
You can get the Sales Order status in Table VBUK & VBUP at Item Level.
To achieve the Open Value , first consider the Open Quantity.Refer VBAP - KWMENG (Order Quantity) , then from LIPS - LFIMG (Delivery Quantity) , you will get the Open Quantity & then accordingly you will get the open Value.
Best Regards,
Ankur -
Table name& field name for production order & operation confirmation
Hi All,
I would like to know the table name and field name for the production order "confirmation" (CNF) and the operation confirmation (CNF).
Thanks and Regards,
PSSHi there,
CORU(R/3 Application development: PP Confirmations )
AFFW Goods movements with errors from confirmatio
AFRC Table of planned changes to conf.: Automatic
AFRD Default values for collective confirmation
AFRH Header information for confirmation pool
AFRP1 Table of planned changes to conf.: Automatic
AFRP2 Table of planned changes for confirmation: B
AFRP3 Table of planned changes for confirmation: C
AFRP4 Table of planned changes to confirmatn: Data
AFRU Order completion confirmations
AFWI Subsequently posted goods movements for conf
TAFWD CORU: Messages that are not interpreted as e
TCORD Table for field-dependent check routines
TCORU Parameters for order confirmations
TCORV Table with Routines for structureing variabl
TCORW Confirmation: Window Control
TPARU Control parallelized confirmation processes
TPRRU Control table for process chain for confirma
TPRRUT Text table for process control of confirmati
TRUGS User status caused by deviation
CO(R/3 Application development: PP Production orders )
AFBP CIM order: Batch print requests
AFFL Work order sequence
AFKO Order header data PP orders
AFPO Order item
AFVC Operation within an order
AFVU DB structure of the user fields of the opera
AFVV DB structure of the quantities/dates/values
FAPW Index of production-/issuing plant for produ
FTIND Missing parts index
ORDCOM Communication control Operation download
T024F Production scheduler
T399X Parameters dependent on order type
T441C Profile - availability check
T441CT Texts for Profile "Display Availability Chec
T490 Transactions PP - orders - order category
T496B CIM order: Assigning document types to refer
T496D CIM: Destination/lists/spool parameters per
T496F CIM order: Form description of the list
T496K CIM order: Entity table of possible table id
T496N CIM order: List descriptions
T496P Print PP documents: Determination of output
T496R Print PP shop papers: Report control
T496T Print PP shop papers: Transaction control
T496V PP Print: Default Value for Printing Online
T496Z CIM order: Table-controlled table access
TC32 Assigning subscreen to processing location
TC34 Allocating operation to object type for the
TC62 Sequence of detail screens when processing h
TCO01 Sequence/operations control in logicstics or
TCO03 CIM order: Texts for TCO01, Description of o
TCO04 Table for controlling the screen sequence gr
TCO05 CUA status depending on panel, trans. type,
TCO06 Exclusive functions for PP orders
TCO09 CIM order: Text IDs of objects in orders
TCO10 Valuation variant for order costing
TCO11 Control table for production orders - availa
TCO12 Control table production orders - stock dete
TCO36 PP orders: Control table for calling up pop-
TCO41 CIM order: Default values for generating ope
TCO43 PP-SFC order profile
TCO43T Description of production scheduler profile
TCO60 Sequence keys for input facility and verific
TCO61 Sequence key for PP orders
TCO62 Defining screen sequences for input facility
TCO63 Sequence of detail screens when maintaining
TCODB Database fields development class CO per ord
TCOF Profile for missing parts info system
TCOFF Profile for Missing Parts Info System: Displ
TCOFFT Texts for Missing Parts Info System: Display
TCOFG Profile for missing parts info system: crite
TCOFGT Texts for Missing Parts Info System: Criteri
TCOFK Texts for functions in milestones/trigger po
TCOFS Profile for Missing Parts Info System: Sort
TCOFST Texts for Missing Parts Info System: Sort Cr
TCOFT Texts for Missing Parts Info System
TCOKO Constants for PP orders
TCOKT Account assignment categories for order
TCOP Field selection profile
TCOPS Field selection profile
TCOPT Description of Profile for Field Selection
TDUMMY Dummy structure of a table for READ with VER
TRUG Reason for variances in completion confirmat
TRUGT Text describing the reason for a variance in
TXPR1 XPRA control - missing parts info system
Regards
Hemant G
Maybe you are looking for
-
Add SC Item Detail View as an usage in my own WDA?Can you guide me?
As the title,I want to add SC detail view in my own WDA Viewcontainer. And use the item GUID to control the data. I tried to add the componet '/SAPSRM/WDC_UI_SC_OIF_CA' in the 'Used componet' and bind the 'IV_L_FPC_OIF_CA' in the view container. But
-
HELP IMPORTING INTO LIGHTROOM 4.4
I am having problems all of a sudden importing my RAW files into Lightroom. I have been doing nothing different and have been using the same equipment. Can someone please help? It just says that it can't read the files.
-
XLIFF HELP PLEASE URGENT in E-Business Suite.
Hello all. I have been strugling with XLIFF configuration for several days and am under a deadline to get this working. I have been able to successfully get it working in the development machine under microsoft word. Loading the translation file in w
-
oracle data cartridge提供了extensible optimizer interface,通过这些接口可以自定义函数的代价值或定义对象成员函数的代价值,当两个代价不同的函数出现在where条件中时,oracle 优先执行代价小的函数.但是当一个对象含有一个嵌套表属性时,上面的那种规则就失效了,where条件中函数的执行顺序和它们的出现顺序是相同的,即:不是优先执行函数代价小的函数.这是什么原因呢? 数据库版本为oracle 10g <code> create or repla
-
ITunes 12.0.1.26x64 installation issue Windows 7
Hi, I'm having trouble installing iTunes 12 on my Windows 7 (x64) notebook and desktop. Below is the error I'm seeing when copying new files. The installer has insufficient privileges to access this directory: C:\Program Files\(x86)\iTunes\iTunes.Res