Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Collating Sequence

499236Jan 10 2008 — edited Jan 10 2008
What is a collating sequence?
DECLARE
last_name1 VARCHAR2(10) := 'COLES';
last_name2 VARCHAR2(10) := 'COLEMAN';
BEGIN
IF last_name1 > last_name2 THEN
DBMS_OUTPUT.PUT_LINE ( last_name1 || ' is greater than ' || last_name2 );
ELSE
DBMS_OUTPUT.PUT_LINE ( last_name2 || ' is greater than ' || last_name1 );
END IF;
END;

output: COLES is greater than COLEMAN
I found this example in this link
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/datatypes.htm#sthref869

1.Can we check how values are compared based on the collating sequence during the above block execution?

2.Is there any sql command to check the collating sequence values of characters in a string.

Please let me know in case of disconnects.

Thanks in advance

Comments

damorgan
Read your request two times ... I understand your code ... but I have no idea what you are actually asking and you didn't include a version number.

Is what you are trying to do in any way related to the capabilities already built into Oracle in the UTL_MATCH package?

http://www.psoug.org/reference/utl_match.html
499236
I got the correct answer from the link given by Dima.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions099.htm#i78399
BluShadow
Not quite sure how that relates to collating sequences.

Example of collating sequences from the documentation on regular expressions...


For example, to find the collating sequence 'ch', use the following regular expression:

[[.ch.]]

This expression matches the sequence 'ch' in the following string:

chabc

The expression does not match the following string:

cdefg

You can use the collating sequence operator in any regular expression where collation is needed. For example, to specify the range from 'a' to 'ch', you can use the following expression:
2889
http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28843/tdddg_globalization.htm#TDDDG62810

http://download.oracle.com/docs/cd/B28359_01/server.111/b28298/ch5lingsort.htm#NLSPG005
499236
Well ...I was not aware of this anyway. I got the reasonable explanation for the block and its output I have posted and hence I suggested the same in my earlier reply.

Thanks for your explanation as well.
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 7 2008
Added on Jan 10 2008
5 comments
741 views