First value in ORDER MIN different BY
Hello
According to the docu NLS_SORT must determine the order of sort ORDER BY and MIN/MAX
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production |
SELECT *. OF nls_session_parameters Setting WHERE = "NLS_SORT. OR a parameter = "NLS_COMP; VALUE OF THE PARAMETER ----------- ------- NLS_SORT GERMAN BINARY NLS_COMP |
I therefore expect that I get the same first / min and last/max values of the following
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production |
WITH testdata as) SELECT 'A' double UNION ALL c SELECT 'B' c IN double UNION ALL SELECT '0' c TO double UNION ALL SELECT '1' c double UNION ALL SELECT FROM c '2' double ) SELECT MAX (c) MIN (c) OF testdata. MAX (C) MIN (C) ------ ------ B 0 WITH testdata as) SELECT 'A' double UNION ALL c SELECT 'B' c IN double UNION ALL SELECT '0' c TO double UNION ALL SELECT '1' c double UNION ALL SELECT FROM c '2' double ) C SELECT ASCII (c) OF testdata ORDER BY c; C ASCII (C) - ---------- A 65 B 66 0 48 1 49 2 50 |
So I read on the sort
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production |
ALTER SESSION SET NLS_SORT = "BINARY"; C ASCII (C) - ---------- 0 48 1 49 2 50 A 65 |
B 66
Now, I get the expected results, but I can't always explain why a linguistic sort order letters before numbers and why it's different to ORDER BY and MAX/MIN.
Concerning
Marcus
According to the docu NLS_SORT must determine the order of sort ORDER BY and MIN/MAX
OK, but you overlooked that part:
Accurate operators and the query clauses that obey to the
NLS_SORT
parameter depends on the value of theNLS_COMP
parameter. If a clause or an operator does not comply to theNLS_SORT
value, as determined byNLS_COMP
, the collation used isBINARY
.
In your example, MIN and MAX always use BINARY collation, unless NLS_SORT is set to a specific language and NLS_COMP is LINGUISTICS.
On the contrary, ORDER BY, always obeys the NLS_SORT setting regardless of the NLS_COMP parameter.
This summarizes what operator and SQL clause obeys what parameter:
Linguistic sorting and string search
Tags: Database
Similar Questions
-
How to find the value max and min for each column in a table 2d?
How to find the value max and min for each column in a table 2d?
For example, in the table max/min for the first three columns would be 45/23, 14/10, 80/67.
Thank you
Chuck,
With color on your bars, you should have enough experience to understand this.
You're a loop in the table already. Now you just need a function like table Max and min. loop. And you may need to transpose the table 2D.
-
mark the first value of a group
I get the following
I would like to mark only the first value in the group with an asterisk as follows.16:57:28 >r 1 with my_table as 2 ( 3 select 'M082012' pera, to_number(10584338) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all 4 select 'M092012' pera, to_number(15965177) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all 5 select 'M082012' pera, to_number(14254501) snr, to_number(20) pnr, 'Wallen' name, 'Monika' f_name from dual union all 6 select 'M082012' pera, to_number(10584339) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all 7 select 'M092012' pera, to_number(15965178) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all 8 select 'M012013' pera, to_number(10674833) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all 9 select 'M012013' pera, to_number(10674834) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all 10 select 'M012013' pera, to_number(10539210) snr, to_number(30) pnr, 'Klose' name, 'Werner' f_name from dual union all 11 select 'M012013' pera, to_number(12345678) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all 12 select 'M012013' pera, to_number(22345789) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all 13 select 'M082012' pera, to_number(10584346) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all 14 select 'M062012' pera, to_number(10550971) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all 15 select 'M092012' pera, to_number(15965185) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all 16 select 'M082012' pera, to_number(10584352) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all 17 select 'M092012' pera, to_number(15965191) snr, to_number(80) pnr, 'Duster' name, 'Hucke' f_name from dual) 18 select case when pera = 'M012013' then '*' end mark, 19 pera, snr, pnr, name, f_name 20 from ( 21 select pera, snr, pnr, name, f_name, 22 max(case when pera = 'M012013' then 'Y' end) 23 over(partition by upper(name||f_name)) m_flag, 24 count(*) over(partition by upper(name||f_name)) cnt 25 from my_table 26 ) 27 where m_flag = 'Y' 28 and cnt > 1 29* order by 4,5,6, to_number(substr(pera,4,4)||substr(pera,2,2)) desc MARK PERA SNR PNR NAME F_NAME ----- ------- ---------- ---------- ------ ------ * M012013 10674834 15 Tester Toni * M012013 10674833 15 Tester Toni M092012 15965177 15 Tester Toni * M012013 22345789 50 Meier Otto * M012013 12345678 50 Meier Otto M082012 10584352 50 Meier Otto
MARK PERA SNR PNR NAME F_NAME ----- ------- ---------- ---------- ------ ------ * M012013 10674834 15 Tester Toni M012013 10674833 15 Tester Toni M092012 15965177 15 Tester Toni * M012013 22345789 50 Meier Otto M012013 12345678 50 Meier Otto M082012 10584352 50 Meier Otto
Perhaps this example might be useful for you. the code uses the same code that you published with additional analytical query to return the row grouping for the name, the NRP and columns pera. then use that line number to determine which will be placed at the first mark.
SQL> with my_table as 2 ( 3 select 'M082012' pera, to_number(10584338) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all 4 select 'M092012' pera, to_number(15965177) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all 5 select 'M082012' pera, to_number(14254501) snr, to_number(20) pnr, 'Wallen' name, 'Monika' f_name from dual union all 6 select 'M082012' pera, to_number(10584339) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all 7 select 'M092012' pera, to_number(15965178) snr, to_number(10) pnr, 'Beule' name, 'Anna' f_name from dual union all 8 select 'M012013' pera, to_number(10674833) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all 9 select 'M012013' pera, to_number(10674834) snr, to_number(15) pnr, 'Tester' name, 'Toni' f_name from dual union all 10 select 'M012013' pera, to_number(10539210) snr, to_number(30) pnr, 'Klose' name, 'Werner' f_name from dual union all 11 select 'M012013' pera, to_number(12345678) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all 12 select 'M012013' pera, to_number(22345789) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all 13 select 'M082012' pera, to_number(10584346) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all 14 select 'M062012' pera, to_number(10550971) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all 15 select 'M092012' pera, to_number(15965185) snr, to_number(77) pnr, 'Carl' name, 'Frank' f_name from dual union all 16 select 'M082012' pera, to_number(10584352) snr, to_number(50) pnr, 'Meier' name, 'Otto' f_name from dual union all 17 select 'M092012' pera, to_number(15965191) snr, to_number(80) pnr, 'Duster' name, 'Hucke' f_name from dual) 18 select case when pera = 'M012013' and rn = 1 then '*' end mark, 19 pera, 20 snr, 21 pnr, 22 name, 23 f_name 24 from (select pera, snr, pnr, name, f_name, 25 row_number() over (partition by pera, pnr, name, f_name order by pera, pnr, name) rn 26 from (select pera, snr, pnr, name, f_name, 27 max(case when pera = 'M012013' then 'Y' end) 28 over(partition by upper(name||f_name)) m_flag, 29 count(*) over(partition by upper(name||f_name)) cnt 30 from my_table) 31 where m_flag = 'Y' 32 and cnt > 1 33 order by 4,5,6, to_number(substr(pera,4,4)||substr(pera,2,2)) desc) 34 order by 4,5,6, to_number(substr(pera,4,4)||substr(pera,2,2)) desc; MARK PERA SNR PNR NAME F_NAME ---- ------- ---------- ---------- ------ ------ * M012013 10674834 15 Tester Toni M012013 10674833 15 Tester Toni M092012 15965177 15 Tester Toni * M012013 22345789 50 Meier Otto M012013 12345678 50 Meier Otto M082012 10584352 50 Meier Otto 6 rows selected SQL>
-
Set the first value after the select statement
Hello
I have a problem here.
After you run the statement select, it'll come to me:
COM
DLY
EXC
NRD
RDY
My question: How can I set the first value instead of 'COM' in "EXC"?
Thank you.Hello
Where you use this instead:select * from ( select col_name ,case when col_name='EXC' then 1 else 0 end as "id" from table_name ) order by "id" desc
-
I have a column with two values, separated by a space, in each line. How do I create 2 new columns with the first value in one column and the second value in another column?
Add two new columns after than the original with space separated values column.
Select cell B1 and type (or copy and paste it here) the formula:
= IF (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')
shortcut for this is:
B1 = if (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')
C1 = if (Len (a1) > 0, Member SUBSTITUTE (A1, B1 & "", ""), "")
or
the formula of the C1 could also be:
= IF (Len (a1) > 0, RIGHT (A1, LEN (A1) −FIND ("", A1)), "")
Select cells B1 and C1, copy
Select cells B1 at the end of the C column, paste
-
The value first values keep replacement old one despite the position of file
I recorded in file and I used the backup of the file function.
It works well and for each race, I have 6 values, however the second run there, the first new value replaces the old first value but others work well.
What can I do? I put the post at the end for each value collected.
Thank you
I think you would benefit greatly from watching the LabVIEW tutorials.
Just a few things off the bat:
Try to escape using sequences stacked to repeat the code. You will do much better with a machine of State or with the help of a Subvi.
Do not use a local variable to the FileRefnum. Use the cable itself.
-
I wrote two LabVIEW applications. The first acquires data from three different devices, displays the data and writes it to a file. The second application reads the data and displays it on the screen.
Can I install the first application and run it, but I can only install the second application if I uninstall the first application.
Any ideas as to why this is happening?
You install applications by using a Setup program created with the application builder to LV?
What LV version do you use?
You have a dedicated for each installer build script, or do you still want to change the settings of a single build script (which would be a reason for this behavior!)?
hope this helps,
Norbert
-
Hi all
I need the values according to below 2logics in a single select query using instring and substring
1 values based on the following logic 'values after the first values of two '_' and before last '_' values '.
2 values based on the following logic 'values after the first values of two '_' and before last'-'values '.
EXM:
Entry: ABCD_EFGH_IJKLM - NOPQ_XYZ output: IJKLM - NOPQ
Entry:. ABCD_EFGH_IJKLM - NOPQ output:IJKLM
Thank you.
Check the following
WITH DATA1 AS
(SELECT "ABCD_EFGH_IJKLM - NOPQ_XYZ" double val)
UNION ALL
SELECT 'ABCD_EFGH_IJKLM - NOPQ' double val
)
SELECT SUBSTR (VAL, INSTR(VAL,'_',1,2) + 1, DECODE (BIGGER (INSTR (VAL, '_',-1, 1), INSTR(VAL,'-',-1,1)), INSTR (VAL,'-', - 1, 1), LENGTH (VAL) + 1, INSTR (VAL, '_',-1, 1))-(INSTR (VAL, '_', 1, 2) + 1))
OF DATA1;
Concerning
Salim
-
selectOneChoice displays the first value of the attribute
Hi people,
In my demo application, there are a couple of selectOneChoice drop down LOV which are based on the query based VO. The UnselectedLabel property is set to "No Selection". These LOVs are used to filter the set of query data. When the drop down menus are not called and the push of a button, the LOVs, behind the stage, have the first value of the attribute that is assigned automatically. Is there a way to ciircumvent the issue without the implementation of valueChangeEventListener?
Thank you
udys
udys,
It's not like you have implemented correctly.
1. the error message says:
"The class"oracle.summit.selfservice.view.HZHRLocsocBean"does not have the property"vLocvalue"
On the screenshot, it is clear that the name of the variable is "fromLovValue" and not "vLocvalue". Please make sure you use the correct name.
Reference:
See you soon
AJ
-
Select list failed at the first value
APEX Version: 4.1.1.00.23
Oracle database: 11g
Question: The application updates the value selected in the list of selection (O/N) to the database, but at the front end, the selection list is set by default to display only the first value in the list. I think this is the data type of the field in the table attached to this select list is TANK (2). And change to VARCHAR2 (2), it worked fine. Now whichever option I choose in the selection list is updated and displayed on the front as well.
I do not understand why is this to mess with (2) TANK. Someone at - it explain it please, I'd appreciate it really.
Thank you
Chrystelle
never use CHAR() in your tables.
TANK always touch your strings to the exact same length.
In your case, you compare the value to the value of the list of the 'Y' table 'Y '.
declare
a tank (2): = 'Y ';
b varchar2 (2): = 'Y ';
Start
dbms_output.put_line ('element A as a sign of ' | length (a)); -This will ALWAYS have a length of 2
dbms_output.put_line ('Variable A as a sign of ' | length (b));
end;
-
first value in multiple columns
Published by: 846773 on 11 January 2012 10:20Hi experts, select * from ( select 1 col1,3 col2,5 col3 from dual union all select 6 col1,5 col2,5 col3 from dual union all select 2 col1,3 col2,5 col3 from dual union all select 10 col1,3 col2,5 col3 from dual union all select 11 col1,3 col2,5 col3 from dual ) I have to get the first value from the each rows: first_value ----------- 1 6 2 10 11 Thanks in advance
Or maybe he wants to say:
select coalesce(col1,col2,col3) first_value from ( select 1 col1,3 col2,5 col3 from dual union all select 6 col1,5 col2,5 col3 from dual union all select 2 col1,3 col2,5 col3 from dual union all select 10 col1,3 col2,5 col3 from dual union all select 11 col1,3 col2,5 col3 from dual )
accounting for null values.
Published by: BluShadow on January 11, 2012 15:44
stupid citrix browser didn't paste correctly -
Drop-down list always displays the first value? How can I empty place
I have several drop down from the fields list. An example would be the city. It allows a user to select a city. I want the form to be completely empty to start. Currently, when the form is initially pulled up, it shows the first value in the list. All my drop-down list fields exhibit the same behavior. Is it possible to be just empty instead?
You can send the form to [email protected] and I'll take a look to see what is happening?
Thank you
Paul
-
Select the first value in the list of values when running in poplist
Hello
IM using forms 6i. I filled the poplist by request. But what I need, I want to choose the first value in the list of values when running...
That is to say, during execution, the poplist should have chosen its first value in the list of values.
What to do...
Concerning
SeryWHEN CREATING a RECORD of the block of the list item or after the filling of the list item, you can write
: my_list_item: = GET_GROUP_CHAR_CELL ('my_list_item', 1); / * If the data type of the item in your list is character.*.
Here, instead of 1, you can give any clue... 1: value to the first list item position
-
Select list first value problem using AJAX
Hello
I've implemented the list of selection in AJAX by allusion to Denes Kubicek - http://apex.oracle.com/pls/otn/f?p=31517:119:3737449055187298:NO. I have only 2 selection lists. The AJAX functionality doesn't quite work for the first selected value in the list select a first. I get not all values in second SelectList when the first value is selected in the first SelectList. It works very well for the rest of the values in the first selection list. I kept a few warning messages to debug JavaScript. I think the problem is with the function below,
get var = new htmldb_Get (null, html_GetElement('pFlowId').value,
= States_In_County', 0);
Get.Add ('F109_AJAX_COUNTY', html_GetElement (pThis) .value);
gReturn = get.get ('XML');
For the first value in the first list of Select, gReturn.getElementsByTagName("option").length; Returns 0.Hello:
What is the value of the 'back' of the article 1st of the 1st list select? The value is compatible with the data type of the column of wl.location_id?
CITY
-
C.P. LOV values in order
Dear all,
I use below following the defined table type value for current month and 12 months in the program simultaneous lov.
When I run the SQL in Toad returning rows in descending order as jul-14, jun-14, May 14 up etc 12 months.
But when I check in the program simultaneous lov, values are not in order, they are scattered like first august13 apr-13 jul-14, jan-14 as.
Could you please advise how I can limit it someone and values will be returned in descending order.
Kind regards
Amit
Please try to add order by clause
level control
Maybe you are looking for
-
Problem is the same as https://support.mozilla.org/en-US/questions/1000745?esab=a & as = aaq In addition, there was no solution has been given in the discussion.Yes, problem that no one could delete all the data that has been synchronized with the ne
-
To access the videos on iPhone on iMac
When I shoot still photos on my iPhone 6 Plus, they automatically appear on my iMac under Aperture (via Shared > iCloud > My Photo Stream). When I turn the video on my iPhone 6 more, I don't know where they're going. I checked iMovie; nothing. My qu
-
rather than see a website, I always see an error page (even offline)
For several days, I see an error page when you try to view a web site. I knew something was wrong when I arrived at the same error offline page. I checked another browser and the Web site is as always, no error. I prefer to use firefox.
-
How can I change the font size in El Capitan? I upgraded from Lion and cannot see the small font on all screens or apps very well at all. I remember in Lion under system preferences an adjustment of display settings for different screens. El Capitan
-
How am I able to import emails from hotmail in Windows Outlook Express for Windows 98?
My grandfather is not familiar with Windows 98, I understand that it is a version absolete. It is impossible to access his e-mail from your Windows Live Hotmail account I would like to know how to import messages from a hotmail account in Outlook Exp