Soundex function query.....???
Hi guys,
Hope you all f9, I have a query regarding Soundex function in ORACLE 9i EE.
I have a table STUDENTRESULT in which a column COURSENAME, and there are two records in that table.
DATA:
rec#1: BUSINESS MATHEMATICS
rec#2: BUSINESS COMMUNICATION
when i run this query :
select coursename, soundex(coursename) from studentresult;
Query result is :
BUSINESS MATHEMATICS B252
BUSINESS COMMUNICATION B252
I know that Soudex function matches first 5 characters in the string but my questions is , Can we segregate the result in a manner that it gives diff value word by word in the whole string?
regards
qamar
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1400328669393
and search for "use Levenshtein distance formula" on this link; may be helpful to you.
Similar Messages
-
Can we use SOUNDEX function in OWB?
Hi
Can we use SOUNDEX function in OWB. If yes then how?
Regards
VibhutiIn Expression operator or in Filter, etc. you can type function name by hand.
Oleg -
How to Create a Functiona Query
Dear all,
Could any body detail me how to create a functional query. Please give me step by step procedure to create a query.
I would appreciate if you can give me a material with screen shots. Your help will be highly appreciated.
Thank you
Raghu RamHi Raghu,
Go through this document it may help you,
SAP Query
Step 1: Create User Group SQ03
Follow the menu path SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > User Groups
a) In the User Group: Initial Screen -
Enter User Group Code (self named)
Click on Create
b) In the User Group (Code): Create or Change pop-up window -
Enter the User Group Description
Click on Save
c) In the Create Object Directory Entry pop-up window -
Ö Click on Local Object button
Ö The User Group Created is saved
Step 2: Create User Group SQ02
Follow the menu path SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > Infosets
a) In the Infoset: Initial screen -
Ö Enter Infoset Code (self named)
Ö Click on Create button
b) In the Infoset: Title & Database Screen -
Ö Enter Description of Infoset in the Name field
Ö In the Data Source selection: Select appropriate Data Source by clicking
the radio button
· Source the data can either be multiple tables OR single table. There are 4
options for the user to select from
Ö Click on Continue (Enter)
Ö Selected Table gets displayed in the Infoset : Initial Screen
c) In the Infoset: Initial Screen -
Ö Click on Insert Table button
d) In the Add Table Screen -
Ö Enter the Table Name that is to be inserted
Ö Click Continue (Enter)
e) In the Infoset: Initial Screen -
Ö Click on Back button
f) In the Field Group Defaults pop-up Screen -
Ö Select Appropriate Field Group Option by clicking on the radio button
· there are 3 options to select from. User can select Empty Field Group
option and then select the data fields in the steps explained further.
Alternatively, User can select an option which clubs all the data fields
From all the tables selected
Ö Click Continue (Enter)
g) In the Change Infoset Screen -
· the left side lists the Tables that the user has selected in step b, c & d
· In the right side, system creates field groups, one for each table listed in the
left part. Initially, the Field Groups are empty
Ö In the Left Side, Click on the arror next to the table name and expand and
display all the data fields in the table
Ö Select a Data Field from the expanded Table view, which is to be added to
the Field Group on the right.
Ö Select a Field Group on the right side, in which Data Field selected above
has to be added
Ö Right click on the Data Field selected and click on Add Field to Field Group
Ö The selected Data Field gets added to the selected Field Group, which is
indicated by an arrow next to the Field Group.
Ö Carry out the steps above to add the required Data Fields to the respective
Field Groups
Ö After transferring Data Fields to Field Groups click on Generate button
h) In the Create Object Directory Entry Screen -
Ö Click on Logical Object button to generate the infoset
i) In the Change Infoset Screen -
Ö Click on the Back button
j) User is taken back to the Infoset: Initial Screen which displays the
created Infoset record.
Step 3: Assigning User Group to Infoset SQ03
Follow the menu path SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > User Groups
a) In the User Groups: Initial screen -
Ö Enter the User Group for which Infoset is to be assigned
Ö Click on Assign Users & Infosets button
b) In the User Group: Assign Users Screen -
Ö Click on Assign Infosets button
c) In the next screen, select the Infoset, which needs to be attached to the
User Group selected
d) Click on the Back button
Step 4: Creating Query SQ00 & SQ01
Follow the menu path SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > Queries
a) In the Query from User Group: Initial Screen -
Ö Click on Other User Groups button
Ö In the pop-up screen, User Groups, select the User Group for which the
Query has to created. The pop-up screen closes.
Ö Enter the Query Code in the Query field
Ö Click on Create button
b) A pop-up screen Restrict Value Range shows the list of Infosets assigned to
the User Group
Ö Select the Infoset for which Query has to be created
c) In the new screen Create Query: Title, Format -
Ö Enter the Description of the Query in the Title field
Ö Click on the Next Screen button
d) In the Select Field Group screen
Ö Select the Field Groups from which Data Fields have to be selected for the
Output
Ö Click on the Next Screen button
e) In the Select Field screen -
Ö Select the Data Fields, which should appear in the output
Ö Click on the Next Screen button
f) In the Screen Selection -
Ö Select the Data Fields for the selection criteria
Ö Enter the sequence in which the selected fields would appear in the input
screen of the query.
Ö Define if the selection criteria should be Single Value or Multiple Value Range
by clicking in the appropriate check boxes
Ö Click on the Basic List button
g) In the screen Query Layout Design -
Ö Select the Output Fields from the Data Fields section by clicking the
appropriate check box
Ö Change the sequence of Data Field columns if required
Ö Click on the Test button to test the query created
h) On the Test Query screen click Continue
i) In the Query screen -
Ö Enter the selection criteria
Ö Click on Execute button
j) Save the Query created
Step 5: Running the Query SQ00
a) In the Query From User Group: Initial screen
b) Click on Other User Groups button to select the User Group
c) In the pop-up screen User Groups select the User Group
d) System lists all the queries created for the User Group
e) Select the appropriate Query
f) Click on Execute button
g) User is taken to the Selection screen
h) Enter the selection criteria and click on Execute button
i) System runs the query and gives the output
Regards,
Murali. -
Error: [msnodesql] Invalid passed to function query
i create a schedule.
I try to run this code:
var todoItemtable = tables.getTable('TodoItem');
var item = {text:"blahblah"};
todoItemtable .insert(item, {
success: function() {
console.log('Inserted event: ', item);
or this:
var sql = "select * from TodoItem";
mssql.query(sql, {
success: function(results) {
console.log('Success: ', results);
}, error: function(err) {
console.log('Error: ', err);
but always get an error: [msnodesql] Invalid passed to function query. Type should be .
What is the problem? What am I doing wrong?Mal,
I think that need to provide more information about what you are doing when you get this error. This appears to be a LV error.
1)What version of LV are you using? What are you doing in TestStand when you get this error?
2)Is your TestStand sequence calling a VI from which this error is generated? If so what is this VI doing?
3)Can you isolate the source of this error to a particular VI that is using queues?
4)How often does the error occur?
5)The path of Queue Core.vi is \vi.lib\Platform\synch.llb\Queue Core.vi. Can you put some probes on the input of this VI to determine what inputs are causing this error? What are all of the inputs to this VI when the error occurs?
6)Is queue being created or destroyed? Is an element being added or removed from a que
ue?
7)Is this your queue or a queue used by one of LV's VIs?
Unless someone has had this exact error, then it is going to be difficult to debug without more information. Clearly, the problem is easiest to solve if it is reproducible by others. -
Self-join query to Analytical function query
Hi All,
I have converted a self-join query to Analytical function query due to the performance reasons.
Query which is using Analytical function is giving the correct count as I compared it with query using Self-Join. Can you please tell what is wrong in the query.
==========================
Query using Self-Join
select count(1)
From (select t1.*, max(t1.dw_creation_dt) over (partition by t1.empl_id) pers_max_date
from ohr_pers_curr t1 ) pers
, (select t2.*, max(t2.dw_creation_dt) over (partition by t2.empl_id, t2.empl_rcd) job_max_date
from OHR_JOB_CURR t2) job
where pers.empl_id = job.empl_id
and pers.dw_creation_dt=pers.pers_max_date
and job.dw_creation_dt=job.job_max_date
and job.dummy_row_flag = 'N'
and pers.dw_creation_rsn_cd in ('N', 'U')
and job.dw_creation_rsn_cd in ('N', 'U')
================================================
Query Using Analytical function
select count(1)
From (select t1.*, max(t1.dw_creation_dt) over (partition by t1.empl_id) pers_max_date
from ohr_pers_curr t1 ) pers
, (select t2.*, max(t2.dw_creation_dt) over (partition by t2.empl_id, t2.empl_rcd) job_max_date
from OHR_JOB_CURR t2) job
where pers.empl_id = job.empl_id
and pers.dw_creation_dt=pers.pers_max_date
and job.dw_creation_dt=job.job_max_date
and job.dummy_row_flag = 'N'
and pers.dw_creation_rsn_cd in ('N', 'U')
and job.dw_creation_rsn_cd in ('N', 'U')
==================================Hi David,
The base is same but the problem is different.
As far as implementation concern these queries looks same, but when I see there counts, they do not match. I do not have any reason why this happening.
Regards
Gaurav -
hi all,
what does soundex function do. please explain with one example.
please provide any article related to this.
thanks in advance,
ramaraju.John Spencer wrote:
Sven W. wrote:
It is not very useful.
Soundex checks only the first few letters of a string (3-6, rarly more). For each string it computes a "magic value". This magic value is identical for similiar sounding texts. In my experience soundex is not feasible of any kind of real world solution. Although there are better algorithms, Soundex is reasonably good on matching English names and such. Because the "magic value" is based on English consonant pronunciations it can be wildly inaccurate with languages that do not share the same sets of similarly voiced consonants.
JohnTo be honest though, I've found soundex to be rubbish, even in English. Much prefer to use UTL_MATCH.JARO_WINKLER_SIMILARITY (or as we call it here, Henry Winkler) with a suitable threshold set (depends on the data being compared). -
Select Into statement in db function - query from granted schema table
problem with "select into" in db function in 10.2
There are two schemas. 'mdbdev' is the master database and 'devusr' is granted SELECT table access to execute queries in mdbdev schema.
with devusr, in SQL, I'm able to execute the following query
select wm_concat(strConcatedCountryList)
from (select country_name as strConcatedCountryList from mdbdev.country_master mdbcm
where mdbcm.country_ship_status = <param?>
order by country_name)
but when I use the same query in function/procedure with "select into", the compilation failed with error *"table or view does not exist"*
FUNCTION GETCOUNTRYLISTTOSHIP (SHIP_STATUS IN NUMBER)
RETURN VARCHAR2
IS
var2CountryList VARCHAR2(1000);
BEGIN
select wm_concat(strConcatedCountryList) INTO var2CountryList
from (select country_name as strConcatedCountryList from mdbdev.country_master mdbcm
where mdbcm.country_ship_status = <value of SHIP_STATUS>
order by country_name);
return var2CountryList;
END;
Please advise/help/hint :)David, Justine, Thank you. The facts from this forum post helped a lot to get the solution.
The query helped a lot (select * from all_tab_privs_recd where owner = 'MDBDEV' and table_name = 'COUNTRY_MASTER").
there was a grant using ???(donno wht DBA said) and no direct SELECT grant on that country_master to "devusr". grant command executed. Now, it works :) -
How to use toplink "build expression" with soundex function
We are using toplink experssion builder to build the query. can any one help me on build a query with soundex using toplink..
for example :
SELECT last_name, first_name
FROM hr.employees
WHERE SOUNDEX(last_name)
= SOUNDEX('SMYTHE');TopLink's ExpressionOperator does have an operator defined for soundex. I have an example that uses it that I customized to match you case.
I would recommend defining these queries as named queries using an after-load method:
public static void afterLoadEmployee(ClassDescriptor descriptor) {
ReadAllQuery raq = new ReadAllQuery(Employee.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
Expression fnExp =
ExpressionOperator.soundex().expressionFor(eb.get("lastName"));
Expression valExp =
ExpressionOperator.soundex().expressionFor(eb.getParameter("L_NAME"));
raq.setSelectionCriteria(fnExp.equal(valExp));
raq.addArgument("L_NAME", String.class);
descriptor.getDescriptorQueryManager().addQuery("Employee.findBySoundexLastName",
raq);
}Now you can execute the query anywhere in your application using:
List<Employee> emps =
(List<Employee>)session.executeQuery("Employee.findBySoundexLastName",
Employee.class, "SMYTHE");The SQL generated is a little different due to the multiple tables used in the employee example model but here is what I got:
SELECT t0.EMP_ID, t1.EMP_ID, t0.F_NAME, t1.SALARY, t0.L_NAME, t0.GENDER, t0.VERSION, t0.ADDR_ID,
t0.MANAGER_ID, t0.END_DATE, t0.START_DATE FROM EMPLOYEE t0, SALARY t1
WHERE ((SOUNDEX(t0.L_NAME) = SOUNDEX('SMYTHE')) AND (t1.EMP_ID = t0.EMP_ID))Doug -
Position function query in XSLT
I have a query regarding XSLT mapping
I have two E1EDK03 segments for the same qualifier. But I want the values based on posiotion
Example:
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110720</DATUM>
</E1EDK03>
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110905</DATUM>
</E1EDK03>
If position = 1, I need the 1st set of E1EDK03
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110720</DATUM>
</E1EDK03>
If position = 2, I need the 2nd set of E1EDK03
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110905</DATUM>
</E1EDK03>
How to achieve that using XSLT
ThanksHi,
Since we have E1EDK03 with same qualifier 012, I don't have any other identifier to distinguish them, because at one instance I need 1st occurrence of E1EKD03 structure and another instance I need the 2nd occurrence of E1EDK03.
If you observe, only DATUM will have different values. I was trying to do that using position function
I have defined a variable to copy the segments and later trying to get the each segment based on position
<!--copying all the E1EDK03 qualifier 012 segments -->
<xsl:variable name="e1edk03_qual_012">
<xsl:for-each select="//IDOC/*">
<xsl:if test="starts-with(name(), 'E1EDK03') and IDDAT = '012'">
<xsl:copy-of select="."></xsl:copy-of>
</xsl:if>
</xsl:for-each>
</xsl:variable>
Now the above code has
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110720</DATUM>
</E1EDK03>
<E1EDK03 SEGMENT="1">
<IDDAT>012</IDDAT>
<DATUM>20110905</DATUM>
</E1EDK03>
I want to split these into two E1EDK03 segments and use further in the XSLT mapping and populate in the target
Thanks -
Pl/sql function querying 2 tables based on bind variable
hey guys, I'm pretty new to pl/sql, but basically I just want to use a select statement based on a searchfield that pulls from 1 of 2 tables based on a bind variable. Here's what I've got so far, but I'm gettting an error message:
declare
q1 varchar2(32767); -- query
q2 varchar2(32767); -- query
begin
q1 := 'select distinct(CBP_CONTENT_CATEGORY) CATEGORY, ' ||
' CBP_FIELDNAME FIELDNAME, ' ||
' CBP_CONTENT_DESC DESCRIPTION ' ||
' from CBP_METADATA_2005 ' ||
' WHERE UPPER(CBP_CONTENT_CATEGORY) LIKE '%' || UPPER(:CBP_SEARCHFIELD) || '%'
' or UPPER(CBP_CONTENT_DESC) LIKE '%' || UPPER(:CBP_SEARCHFIELD) || '%';
q2 := 'select distinct(CBP_CONTENT_CATEGORY) CATEGORY, ' ||
' CBP_FIELDNAME FIELDNAME, ' ||
' CBP_CONTENT_DESC DESCRIPTION ' ||
' from CBP_METADATA_2004 ' ||
' WHERE UPPER(CBP_CONTENT_CATEGORY) LIKE '%' || UPPER(:CBP_SEARCHFIELD) || '%'
' or UPPER(CBP_CONTENT_DESC) LIKE '%' || UPPER(:CBP_SEARCHFIELD) || '%';
if :CBP_YEAR = '1' THEN
q1=q1
RETURN q1
ELSIF :CBP_YEAR = '0' THEN
q2=q2
end if;
RETURN q1;
end;
and here's the error:
failed to parse SQL query:
ORA-06550: line 1, column 8:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin function package pragma procedure subtype type use
form
current cursor
The symbol "" was ignored.
ORA-06550: line 4, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while withLDub,
Your function is full of errors. First of all you didn't escape quotes and second, you didn't use the concatination operator properly. Beside that, there was a bit too much of code there. Here is the modified code that will work for you:
DECLARE
q1 VARCHAR2 (32767); -- query
q2 VARCHAR2 (32767); -- query
BEGIN
q1 :=
'select distinct(CBP_CONTENT_CATEGORY) CATEGORY, '
|| ' CBP_FIELDNAME FIELDNAME, '
|| ' CBP_CONTENT_DESC DESCRIPTION '
|| ' from CBP_METADATA_2005 '
|| ' WHERE UPPER(CBP_CONTENT_CATEGORY) LIKE ''%'' || UPPER(:CBP_SEARCHFIELD) || ''%'''
|| ' or UPPER(CBP_CONTENT_DESC) LIKE ''%'' || UPPER(:CBP_SEARCHFIELD) || ''%''';
q2 :=
'select distinct(CBP_CONTENT_CATEGORY) CATEGORY, '
|| ' CBP_FIELDNAME FIELDNAME, '
|| ' CBP_CONTENT_DESC DESCRIPTION '
|| ' from CBP_METADATA_2004 '
|| ' WHERE UPPER(CBP_CONTENT_CATEGORY) LIKE ''%''|| UPPER(:CBP_SEARCHFIELD) || ''%'''
|| ' or UPPER(CBP_CONTENT_DESC) LIKE ''%'' || UPPER(:CBP_SEARCHFIELD) || ''%''';
IF :cbp_year = '1'
THEN
RETURN q1;
ELSIF :cbp_year = '0'
THEN
RETURN q2;
END IF;
END;
Denes Kubicek -
Datatype issue in function query
Hi,
Below is my table
create table dsource(
prod varchar2(10),
source_dt date,
source_type varchar2(2),
list_owner_nbr number);
insert into dsource values('TOH','01-jul-2010','D',9);
insert into dsource values('TOH','01-jul-2010','D',24);
insert into dsource values('TOH','01-jul-2010','D',238);
insert into dsource values('TOH','01-jul-2010','D',253);
insert into dsource values('TOH','01-jul-2010','D',521);
insert into dsource values('TOH','01-jul-2010','D',617);
insert into dsource values('TOH','01-jul-2010','D',680);
commit;
I created one function
create or replace function mark_camp (v_prod_abbr varchar2,source_dt varchar2,source_type varchar2,v_list_owner_nbr varchar2) return varchar2 as
begin
select *
from dsource
where prod_abbr=v_prod_abbr
and to_char(source_start_dt,'MONYY')=source_dt and mke_mag_source_type_cd=source_type
and list_owner_nbr in(v_list_owner_nbr) ;
return(v_prod_abbr||','||source_dt||','||source_type||','||v_list_owner_nbr);
end mark_camp;
Now I am running one query
select mark_camp('TOH','JUL2010','D','9, 24, 238, 253, 521, 617, 680') from dual;
I am getting 0 rows returned
if I execute
select mark_camp('TOH','JUL2010','D',9, 24, 238, 253, 521, 617, 680) from dual;
then error occurs ORA-06553: PLS-306: wrong number or types of arguments in call to 'MARK_CAMP'
Here list_owner_nbr datatype is number in table and I am passing multiple values in function so I used varchar2 in function
but this query is not working. can anybody please help because user will enter multiple values in list_owner_nbr.799301 wrote:
Now I am running one query
select mark_camp('TOH','JUL2010','D','9, 24, 238, 253, 521, 617, 680') from dual;
I am getting 0 rows returnedThe reason why your first call to function succeed is that anything between single quotes in considered as a single string. so '9, 24, 238, 253, 521, 617, 680' is considered as a single varchar2 value. Your function expectes 4 varchar2 values and the same are being provided.
if I execute
select mark_camp('TOH','JUL2010','D',9, 24, 238, 253, 521, 617, 680) from dual;
then error occurs ORA-06553: PLS-306: wrong number or types of arguments in call to 'MARK_CAMP'In second call you are passing 3 varchar2 and 7 numbers (9,24,238,...are being considered as individual paramerter) and hence the error.
Coming to your actual problem :
Here list_owner_nbr datatype is number in table and I am passing multiple values in function so I used varchar2 in function
but this query is not working. can anybody please help because user will enter multiple values in list_owner_nbr.This is called varying in list and the forum FAQ page has a listing for it :
{message:id=9360009} -
[Function] -Query in result
Hi,
I write the below function to display the bonus of employees
create or replace function Bonus_val (description in varchar2) return number
is
v_bonus number;
cursor j1 is
select description,salary from employee_290512;
begin
for v1 in j1 loop
if v1.description='Tester' then
v_bonus := v1.salary*15;
elsif v1.description='Manager' then
v_bonus := v1.salary*30;
elsif v1.description='Programmer' then
v_bonus := v1.salary*45;
return v_bonus;
end if;
end loop;
end;
whose having a salary range like below
6544.78
1234.56
6661.78
2344.78
2334.78
4322.78
7897.78
1232.78
But while testing the above function it's showing the same values for all category, i"m confused could any one clarify on this please.
Regards
ThelakI'm not entirely sure what you are trying to accomplish here, but the logic is definitely flawed.
The function as written will attempt to read all of the rows from the employee_29051 table. since there is no predicate in the query, it will very likely do it through a full table scan. When the first row of the table is read from the cursor, it will assign a value to v_bonus based on the description field in the first row, and return that to the caller. given a full table scan every time, it is extremely likely that it will do that based on the same row everytime.
Further, the passed parameter description, is never used. It is also a really bad idea to give parmeters the same name as the columns in your tables.
If you post some sample data form the table, and the expected output from the function call based on that data, perhaps someone could sort you out.
John -
Goto functionality (query to query)
Hello,
I created two queries. With transaction "rsbbs" I refer one query as sender-query and the other as receiver-query. If I execute sender-query, for most of characteristics the functionality "Goto" works fine. That means data will display in receiver-query. But there are some characteristics for which no applicable data will found in receiver-query, though they have data. If I execute receiver-query allone with same restrictions, data will found for these characteristics.
What could be the problem? Is it possible to see which restrictions will really used in the background by using functionalíty "Goto" (e.g. debugging)?
Many thanks in advance!
AnneHi,
in the query tab select the receiver then click to 'Assignement details'.
You should have to customize correspondance field.
hope it help's -
Hi All,
I am using Oracle 11g DB.
and I want to search a value with similar sounding.
I come to know that, "Soundex" is caters above functionality.
But its searching whole word only.
I want to search with partial sounding also. (i.e. contains and begins with operations of similar sound).
RegardsHi,
you could have a look at this forum topic about double metaphone: double metaphone In this topic there is a discussion about a lot of other functions similar to soundex. In 11g you can also have a look at UTL_MATCH. It includes some of the functions mentioned in the topic.
Herald ten Dam
http://htendam.wordpress.com -
Hi,
I have below query with mentioned table and data setup. I always want the specific value (in this case 'CAR' or 'BIKE') record as result of this query and if i pass 'ALL' i need that record.
So I use decode function and convert the 'ALL' value to NULL and made it to go last. so on the top always the specific value records will come and from the outer query i can get the 1st record alone.
But the problem is when i run the inner query it works fine but along with outer query I am getting 'ALL' record as the result.
My question is : is the ROW_NUMBER() fuction alias doesn't have scope outside of the inner query.
Note : if i use rownum = 1 instead of rrn=1 it works fine.
Is there anyother alternate solution or any bug in this query.
Table1
col1 col2
A CAR
A BIKE
B ALL
Query:
SELECT indicator
FROM (SELECT indicator, ROW_NUMBER() OVER( ORDER BY DECODE(col2, 'ALL', NULL) asc NULLS LAST) rrn
FROM table1
WHERE (col2 = <Input specific value>
OR col2 = 'ALL')
WHERE rrn = 1;
Thanks in advance.you did not excatly what you ment to do:
Naga wrote:
So I use decode function and convert the 'ALL' value to NULL and made it to go last.You only specified the decode for 'ALL', but said nothiung about the other values. So just add a default.
with table1 as (
select 'A' col1, 'CAR' col2 from dual union all
select 'A', 'BIKE' from dual union all
select 'B', 'ALL' from dual )
SELECT col1
FROM (
SELECT col1, ROW_NUMBER() OVER( ORDER BY DECODE(col2, 'ALL', NULL, 1) asc NULLS LAST) rrn
FROM table1
WHERE (col2 = 'CAR'
OR col2 = 'ALL')
WHERE rrn = 1
COL1
A The "scope" of the row_number() is stable, so you can refer to it from the outer query.
regards chris
Maybe you are looking for
-
Open letter to adobe: What future for Fireworks?
Open letter to adobe: What future for Fireworks? Hello, My name is Fred and I'm a Fireworks user since ever. I prefer to warn you about my complete addiction to this software. There's many discussions on this forum and others, on how you deal with Fi
-
How do I find out what Package a class is in
I am trying to find out what Package the classes XMLNode and XMLInterface are located in. Is there a way to search for a class to find out what package it is held in ? Quite often I see example code but spend wore time working out what package the cl
-
Error when using the variable System::ErrorDescription
HI All, When I try to use the variable System::ErrorDescription I get the following error: The element cannot be found in a collection. This error happens when you try to retrieve an element from a collection on a container during execution of the pa
-
How do I convert yahoo email on iPhone FROM IMAP TO POP?
I have Yahoo Mail Plus. When I first got my iPhone 4, I set it up so my yahoo email was accessible on my phone without my doing anything. I only check the email from two devices: my desktop via the internet, and my iPhone. I'm pretty sure the email s
-
Problem with decimal data visualization in a circular graphic object type
When we are design a report using Crystal Reports 2008 we found the following problem. When we insert an object of type circle graphic selecting the option in the graphics wizard for view in the legend data both in value and percentage (u2018bothu201