How to give more relevance to one of the column in multicolumn datastore
Hi Gurus,
While using multicolumn datastore needed to give more importance to one of the column than the other one. How can we achieve the same ?
SQL> create table test_sh4 (text1 clob,text2 clob);
Table created.
SQL> alter table test_sh4 add (text3 clob);
Table altered.
SQL> begin
2 ctx_ddl.create_preference ('nd_mcd', 'multi_column_datastore');
3 ctx_ddl.set_attribute
4 ('nd_mcd',
5 'columns',
6 'replace (text1, '' '', '''') nd, text1 text1,replace (text1, '' '', '''') nd, text1 text1');
7 ctx_ddl.set_attribute ('nd_mcd', 'delimiter', 'newline');
8 ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
9 ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+');
10 end;
11 /
PL/SQL procedure successfully completed.
SQL> create index IX_test_sh4 on test_sh4 (text3)
indextype is ctxsys.context
parameters
('datastore nd_mcd
lexer test_lex1')
/ 2 3 4 5 6
Index created.Here while querying how can I give more relevance to text1 column than text2 column ?
Every time that you post code, whatever you are using eliminates all formatting and changes any multiple spaces to single spaces, so it makes it hard to tell what your code really is. Within the function, you need to remove the special characters and double spaces before you use the string for anything else. In the first part of your output string, you were only putting a % in front of the first word and after the last word. I fixed it so that it puts % before and after every word. I also added some code to return a score of 100 when an exact match is found in any column. You can use the function in a select from dual to see what it is returning. Please see the demonstration below. I will provide a copy of the function in a separate post that you can copy and paste. You may want to adjust the values that you multiply by. The values of 10 and 5 and .5 and .1 were just examples.
SCOTT@orcl_11gR2> create table test_sh (text1 clob,text2 clob);
Table created.
SCOTT@orcl_11gR2> alter table test_sh add (text3 clob);
Table altered.
SCOTT@orcl_11gR2> insert all
2 into test_sh (text1, text2, text3)
3 values ('staple card', 'word2', 'word3')
4 into test_sh (text1, text2, text3)
5 values ('word4', 'staple card', 'word5')
6 into test_sh (text1, text2, text3)
7 values ('staplecard', 'word2', 'word3')
8 into test_sh (text1, text2, text3)
9 values ('word4', 'staplecard', 'word5')
10 into test_sh (text1, text2, text3) values
11 ('Weber Genesis S-310 Gas Grill',
12 'Weber Genesis S-310 Gas Grill',
13 'Weber Genesis S-310 Gas Grill')
14 select * from dual
15 /
5 rows created.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_preference ('nd_mcd', 'multi_column_datastore');
3 ctx_ddl.set_attribute
4 ('nd_mcd',
5 'columns',
6 'replace (text1, '' '', '''') nd1,
7 text1 text1,
8 replace (text2, '' '', '''') nd2,
9 text2 text2');
10 ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
11 ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+');
12 ctx_ddl.create_section_group ('test_sg', 'basic_section_group');
13 ctx_ddl.add_field_section ('test_sg', 'text1', 'text1', true);
14 ctx_ddl.add_field_section ('test_sg', 'nd1', 'nd1', true);
15 ctx_ddl.add_field_section ('test_sg', 'text2', 'text2', true);
16 ctx_ddl.add_field_section ('test_sg', 'nd2', 'nd2', true);
17 end;
18 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> create index IX_test_sh on test_sh (text3)
2 indextype is ctxsys.context
3 parameters
4 ('datastore nd_mcd
5 lexer test_lex1
6 section group test_sg')
7 /
Index created.
SCOTT@orcl_11gR2> create or replace function text_format
2 (p_string in varchar2)
3 return varchar2
4 as
5 v_string varchar2 (32767);
6 v_string_out varchar2 (32767);
7 v_string_in1 varchar2 (32767);
8 v_string_in2 varchar2 (32767);
9 V_TOKEN VARCHAR2 (32767);
10 BEGIN
11 -- remove special characters and double spaces before using in anything else:
12 v_string := trim (translate (p_string, '/\|-_+&', ' '));
13 v_string := replace (v_string, '''', '');
14 while instr (v_string, ' ') > 0 loop
15 v_string := replace (v_string, ' ', ' ');
16 end loop;
17 -- fixed 2 lines below:
18 v_string_out := '(%' || replace (v_string, ' ', '% %') || '%) ' || ',';
19 v_string_out := v_string_out || '(' || v_string || ')' || ',';
20 -- first search string with spaces:
21 v_string_in1 := v_string || ' ';
22 -- second search string without spaces:
23 v_string_in2 := replace (v_string_in1, ' ', '') || ' ';
24 if v_string_in2 = v_string_in1 then
25 v_string_in2 := null;
26 end if;
27 -- format search string one token at a time:
28 while v_string_in1 is not null loop
29 v_token := substr (v_string_in1, 1, instr (v_string_in1, ' ') - 1);
30 v_string_out := v_string_out
31 || '('
32 || '?' || v_token || ' or '
33 || '!' || v_token || ' or '
34 || '$' || v_token
35 || '),';
36 v_string_in1 := substr (v_string_in1, instr (v_string_in1, ' ') + 1);
37 end loop;
38 while v_string_in2 is not null loop
39 v_token := substr (v_string_in2, 1, instr (v_string_in2, ' ') - 1);
40 v_string_out := v_string_out
41 || '('
42 || '%' || v_token || '% or '
43 || '?' || v_token || ' or '
44 || '!' || v_token || ' or '
45 || '$' || v_token
46 || '),';
47 v_string_in2 := substr (v_string_in2, instr (v_string_in2, ' ') + 1);
48 end loop;
49 -- return formatted string (added score of 100 for exact match in any column:
50 return
51 '(' || v_string || ') * 10 * 10 or
52 (' || rtrim (v_string_out, ',') || ' within text1) * 10 or
53 (' || rtrim (v_string_out, ',') || ' within nd1) * 5 or
54 (' || rtrim (v_string_out, ',') || ' within text2) * .5 or
55 (' || rtrim (v_string_out, ',') || ' within nd2) * .1';
56 end text_format;
57 /
Function created.
SCOTT@orcl_11gR2> show errors
No errors.
SCOTT@orcl_11gR2> select text_format ('STAPLE CARD') from dual
2 /
TEXT_FORMAT('STAPLECARD')
(STAPLE CARD) * 10 * 10 or
((%STAPLE% %CARD%) ,(STAPLE CARD),(?STAPLE or !STAPLE or $STAPLE),(?CARD or
!CARD or $CARD),(%STAPLECARD% or ?STAPLECARD or !STAPLECARD or $STAPLECARD) wit
hin text1) * 10 or
((%STAPLE% %CARD%) ,(STAPLE CARD),(?STAPLE or !STAPLE or $STAPLE),(?CARD or
!CARD or $CARD),(%STAPLECARD% or ?STAPLECARD or !STAPLECARD or $STAPLECARD) wit
hin nd1) * 5 or
((%STAPLE% %CARD%) ,(STAPLE CARD),(?STAPLE or !STAPLE or $STAPLE),(?CARD or
!CARD or $CARD),(%STAPLECARD% or ?STAPLECARD or !STAPLECARD or $STAPLECARD) wit
hin text2) * .5 or
((%STAPLE% %CARD%) ,(STAPLE CARD),(?STAPLE or !STAPLE or $STAPLE),(?CARD or
!CARD or $CARD),(%STAPLECARD% or ?STAPLECARD or !STAPLECARD or $STAPLECARD) wit
hin nd2) * .1
1 row selected.
SCOTT@orcl_11gR2> column text1 format a11
SCOTT@orcl_11gR2> column text2 format a11
SCOTT@orcl_11gR2> column text3 format a11
SCOTT@orcl_11gR2> SELECT SCORE(1), t.* FROM test_sh t
2 WHERE CONTAINS (text3, text_format ('STAPLE CARD'), 1) > 0
3 ORDER BY 1 DESC
4 /
SCORE(1) TEXT1 TEXT2 TEXT3
100 staple card word2 word3
100 word4 staple card word5
100 staplecard word2 word3
10 word4 staplecard word5
4 rows selected.
Similar Messages
-
How to give more than 10 Reward Points
Hi Experts,
For your excellent performance for solving problems, if I would like to give more than 10 "Rewards Point", how can I proceed? Can any expert guide me how to give more than 10 Reward Points?
Thanks,
Hoque
Toronto, CanadaHello
There is one more way to award more than 10 points
This is the table
Designation
Point Value
Awards of This Type Allowed
Solved My Problem
10
1 Time Only
Very Helpful
6
2 Times only
Helpful
2
Unlimited
So if you think you want to give more than 10 points, keep allocating 2 points as many times as you can and finally give the 10.
Reg
*assign points if useful -
How to scan more pages into one PDF file using hP inkjet 2515
Dear friend
How to scan more pages into one PDF file using hP inkjet 2515Dear friend
How to scan more pages into one PDF file using hP inkjet 2515 -
In flex, How to set a value to one parameter, the parameter
defined in a cffunction in a cfc file, In the cffunction there are
much cfargument, I want set a value to one of them, such as the
cfc:
<cffunction access="remote" name="myShow" output="false"
returntype="struct">
<cfargument name="ID" type="numeric" default=0>
<cfargument name="GoodsID" type="string" default="">
<cfargument name="DestTime" type="string" default="">
<cfargument name="DestCount" type="numeric" default=1>
How I set a value to only parameter one of them , such as set
GoodsID when use mx:remoteObject.
Thanks for your helpGot maybe a solution for you, I have just tested it.
So, the idea is to use intermediate variables. Imagine Var1 and Var2 variables that you refresh with your more or less complicated queries. Then what you can do is to refresh your final variable Var3 with a query using your intermediate variables. Here is an example for Oracle:
select #Var1+#Var2 from dual
This way you can make a chain of dependent variables: Var3 is using Var2 and Var2 is using Var1.
Hope it helps.
Shamil -
We have a new computer and I cannot get my garmin running watch to sync with mozilla. The error message that I keep getting is"The address wasn't understood
Firefox doesn't know how to open this address, because one of the following protocols (connectagent) isn't associated with any program or is not allowed in this context.
You might need to install other software to open this address."
Help pleaseThis is for a special URL that starts with
connectagent://
instead of with
http://
is that right?
Two thoughts:
(1) Could you try changing a setting for your Garmin plugin. Here's what I mean:
Open the Add-ons page using either:
* Ctrl+Shift+a
* orange Firefox button (or Tools menu) > Add-ons
In the left column, click Plugins.
Find your Garmin plugin change "Ask to Activate" to "Always Activate".
Your system information seems to list two different versions of a similarly named plugin. I'm not sure whether that is causing a problem.
(2) Does Garmin's documentation specify any extra steps to set up Firefox, other than installing its add-ons? -
Hello .. I need to know please how do I know if some one got the access to my iCloud account and saw my phone contains ? Thanks
Ahmed8885 wrote:
but I was shocked when I log in using my account on my friend iPhone device and I was surprised that I started to receive and see all my photo stream loading to his phone !
Really? What did you expect was gonna happen when you logged in using YOUR APPLE ID/PASSWORD?
That's the way things are supposed to work. -
How to remove spaces present in one of the records in a table
Hi
i have a requirement where i need to delete the spaces present in one of the columns in a table.The table has a column with the data in the form of lastname,firstname.The old data present there has one space between the lastname and the firstname and the new data has no space between the last and the first names.so i need to come out with something that will remove the space between the last and firstname in the old records.
Can you give me some suggestions?Maybe something like this?
SQL> WITH data AS
2 (
3 SELECT 'Oracle,Corporation' lastnamefirstname
4 FROM dual
5 )
6 SELECT REPLACE(lastnamefirstname,',',NULL)
7 FROM data ;
REPLACE(LASTNAMEF
OracleCorporation
1 row selected. -
I renewed my subscription for a third party app and was charged TWICE! $38 bux a pop. How do I go about getting one of the charges refunded?C
You can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption
-
Firefox doesn't know how to open this address, because one of the following protocols (itms-services) isn't associated with any program or is not allowed in this context.
You might need to install other software to open this address."
tried to fix in about:config but itms-services not foundn; also tried to fix using network.protocol-handler.external.foo but that wasn't listed either
trying to download an app related to a rewards gift card
firefox and os versions are up to date on MacBook AirHello!
Would you please provide the link you were trying to visit?
Also, you may want to post this question to the [https://support.mozilla.org/en-US/questions/new/desktop Firefox for Desktop Support Forum] . The Mozilla Support volunteers there may be able to better assist you.
I hope we can help you solve your problem. -
How to store data file name in one of the columns of staging table
My requirement is to load data from .dat file to oracle staging table. I have done following steps:
1. Created control file and stored in bin directory.
2. Created data file and stored in bin directory.
3. Registered a concurrent program with execution method as SQL*Loader.
4. Added the concurrent program to request group.
I am passing the file name as a parameter to concurrent program. When I am running the program, the data is getting loaded to the staging table correctly.
Now I want to store the filename (which is passed as a parameter) in one of the columns of staging table. I tried different ways found through Google, but none of them worked. I am using the below control file:
OPTIONS (SKIP = 1)
LOAD DATA
INFILE '&1'
APPEND INTO TABLE XXCISCO_SO_INTF_STG_TB
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
COUNTRY_NAME
,COUNTRY_CODE
,ORDER_CATEGORY
,ORDER_NUMBER
,RECORD_ID "XXCISCO_SO_INTF_STG_TB_S.NEXTVAL"
,FILE_NAME CONSTANT "&1"
,REQUEST_ID "fnd_global.conc_request_id"
,LAST_UPDATED_BY "FND_GLOBAL.USER_ID"
,LAST_UPDATE_DATE SYSDATE
,CREATED_BY "FND_GLOBAL.USER_ID"
,CREATION_DATE SYSDATE
,INTERFACE_STATUS CONSTANT "N"
,RECORD_STATUS CONSTANT "N"
I want to store file name in the column FILE_NAME stated above. I tried with and without constant using "$1", "&1", ":$1", ":&1", &1, $1..... but none of them worked. Please suggest me the solution for this.
Thanks,
AbhayPl post details of OS, database and EBS versions. There is no easy way to achieve this.
Pl see previous threads on this topic
SQL*Loader to insert data file name during load
Sql Loader with new column
HTH
Srini -
How to make one of the columns in my tabular an text item with popup lov
Hello,
I want to manually make one of the columns say for the deptno in my tabular form as on text item popup lov using apex_item package
and whenever user clicks on the text item popup lov, it should open up an dept table report and from which he/she needs to select
the deptno and this deptno should be returned into the text item popup lov column.
like for example: say if i have an emp table tabular form with all the columns and deptno column as an popup lov and when user clicks on this column
it should open up an new sql report(similar to popup lov window), the select statement for this would be
select deptno,dname,loc from dept order by 1;
And from this popup lov report whenever an user selects a particular deptno, the same deptno should be returned to my text item popup column in emp tabular form.
something like this
select
"EMPNO",
"EMPNO" EMPNO_DISPLAY,
"ENAME",
"JOB",
"MGR",
"HIREDATE",
"SAL",
"COMM",
APEX_ITEM.TEXT(3,deptno,20,50,'readonly=true') || '<img height="16" align="middle" width="16" style="vertical-align: middle;" alt="Popup Lov" src="/i/lov_16x16.gif"/>' deptno
from "#OWNER#"."EMP"
like i made my column as an text item lov and now I want to write an onclick event for the text item lov so that an popup window is displayed which is a sql report of the table dept (select deptno,dname,loc from dept order by 1;) and in this report i want to make deptno as an link so that when ever an user clicks on it
-- this value should be returned to my text item popup lov column deptno in the emp tabular form.
can anyone help me out with this issue.
thanks,Hi,
Refer to the link for the detailed information on ALV Grid.
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
Hope it helps.
Regards,
Rajesh Kumar
Edited by: Rajesh Kumar on May 25, 2009 9:13 AM -
Push button in one of the columns of Table Control
Hi,
I have a requirement, where i have to display a push button in one of the columns of table control for long text. When user clicks on the control, a pop up has to be appeared in which user should be able to enter some meaning ful description and save it. please suggest me how to do this requirement.
Best Regards,
Phani Kumar. SHai,
You can drag n drop a button to the required column in the table control and give the required parameters like ok_code , name etc.
You can now place a text field as the heading of the column.
Now when the user clicks the the button in a row, read the corresponding line in which he has clicked.For that u can use
get cursor lines wrk_line.
now u'll get the data in that row using
Read table it_tab into wa_tab index wrk_line.
now u can call the text editor (using FM's READ_TEXT ,EDIT_TEXT and CREATE_TEXT in which the user can enter the meaningful description and save it.
When u save the text entered save it with a key part of the row that was read earlier(keep it as the text name).
So now if u need to get the description which was entered earlier u can easily read the text (using READ_TEXT ).
I hope this will be helpful for u .
Thanks
Neeraj -
Retrieve as many duplicate records as a value stored in one of the columns
Hi,
I have a peculiar requirement where I want multiple copies of rows the count of which is determined by one of the column values:
create table test (id number, value number, data varchar2(100));
insert into test values (1,5,'one');
insert into test values (2,2,'two);
insert into test values (3,3,'three');
insert into test values (4,4,'four');
insert into test values (5,5,'five');
select * from test where id=3;
I get:
id,value,data
3,3,three
I want:
id,value,data
3,3,three_1
3,3,three_2
3,3,three_3
i.e. Althought there is ONLY ONE row for the id=3, but as the column value=3, i want 3 rows from this table (all identical) except the last column to which I append a running sequential number.
How to do that?
Thanks.You have still pipelined function :
SQL> create or replace type TypeTest as object (id number, value number, data varchar2(100));
2 /
Type created.
SQL>
SQL> create or replace type ListTest as table of TypeTest;
2 /
Type created.
SQL>
SQL> create or replace function TblTest(p_id number default null)
2 return ListTest
3 pipelined
4 is
5 begin
6 for x in (select id, value, data from test where id = nvl(p_id,id)) loop
7 for i in 1.. x.value loop
8 pipe row (TypeTest(x.id, x.value, x.data||'_'||to_char(i)));
9 end loop;
10 end loop;
11 return;
12 end;
13 /
Function created.
SQL> show err
No errors.
SQL>
SQL> select * from table(TblTest(3));
ID VALUE DATA
3 3 three_1
3 3 three_2
3 3 three_3
SQL> select * from table(TblTest);
ID VALUE DATA
1 5 one_1
1 5 one_2
1 5 one_3
1 5 one_4
1 5 one_5
2 2 two_1
2 2 two_2
3 3 three_1
3 3 three_2
3 3 three_3
4 4 four_1
4 4 four_2
4 4 four_3
4 4 four_4
5 5 five_1
5 5 five_2
5 5 five_3
5 5 five_4
5 5 five_5
19 rows selected.
SQL> Nicolas. -
I am writing a database program and have come across this error -
ADO Error: 0x00000001
Argument error. One of the column names specified is blank.
I have tried everything I can think of and have no idea what to try next.
The VI that the error is occuring in (attached written in LV 2011) allows the user to enter in the details of a new user. It then looks up this user to get the ID (primary key) of the user which will be used in another step of the program. The VI writes to the database fine but then comes back with the above error when using the SELECT query. All columns in the database have data in them. Also when i use a differnt VI that just looks up the user/customer it works fine.
I have tried deleting all the code and copying the code from the simpler (look up only) VI but I still get the same error.
I created an indicator for the concatenated text to make sure the query was right and it appears to be fine. So now I am stumped. Any help would be greatly appreciated.
Thanks
Attachments:
AddNewMeasurer.vi 40 KBtripped wrote:
I am writing a database program and have come across this error -
ADO Error: 0x00000001
Argument error. One of the column names specified is blank.
I have tried everything I can think of and have no idea what to try next.
The VI that the error is occuring in (attached written in LV 2011) allows the user to enter in the details of a new user. It then looks up this user to get the ID (primary key) of the user which will be used in another step of the program. The VI writes to the database fine but then comes back with the above error when using the SELECT query. All columns in the database have data in them. Also when i use a differnt VI that just looks up the user/customer it works fine.
I have tried deleting all the code and copying the code from the simpler (look up only) VI but I still get the same error.
I created an indicator for the concatenated text to make sure the query was right and it appears to be fine. So now I am stumped. Any help would be greatly appreciated.
Thanks
The query "appears" fine. Well, obviously it isnt' fine. The database is telling you that.
What is the SELECT query you are sending? -
if my contact has 2 or more cp numbers recorded in my phone book,
how will i determine which one of the cp numbers he is using,
all is shown on my iphone is his recorded name & left me guessing which cp number he is usingWhat To Do If Your iDevice Is Lost Or Stolen
If you activated Find My Phone before it was lost or stolen, you can track it only if Wi-Fi is enabled on the device. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
1. Reporting a lost or stolen Apple product
2. Find my lost iPod Touch
3. AT&T. Sprint, and Verizon can block stolen phones/tablets
4. What-To-Do-When-Iphone-Is-Stolen
5. What to do if your iOS device is lost or stolen
6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
7. Find My iPhone
8. Report Stolen iPad | Stolen Lost Found Online
It pays to be proactive by following the advice on using Find My Phone before you lose your device:
1. Find My iPhone
2. Setup your iDevice on iCloud
3. OS X Lion/Mountain Lion- About Find My Mac
4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)
Maybe you are looking for
-
TS1829 Can't install iTunes on Windows 7 64 bit system
I get this message: "errors occurred during installation before iTunes could be configured" while trying to install iTunes 64 bit on Windows 7 64 bit. Tried turning windows Defender and running it but same result. Itunes worked fine on Vista, but sin
-
Issue with migration of Public folders from Exchange 2010 to Exchange Online.
We are trying to migratie the Public folders structure of one of our clients and are running in an error during migration. We are following the steps provided by https://technet.microsoft.com/en-us/library/jj983799(v=exchg.150).aspx But after creatin
-
R/3 fields assignment to communication structure.
Hi all, Is there a one place(easy way) where I can get a complete list of communcation structure infoobjects and to what R/3 source fields are these infoobjects assigned instead of checking in infosource because it takes a lot of time. please let me
-
Problem with Mavericks 10.9.1
I have just downloaded Mavericks 10.9.1 and on opening the system is opening windows for word, excel, email, Safari all layered on top of each other. I have to close all threse down to get back to the start screen and dock. Can anyone tell me how I
-
Can't load apps into iTunes account
I recently installed a new hard drive in my macbook. I added my music/movies into my account just fine however when I tried to add all my apps into my iTunes account but got error messages and none of them got added. My macbook is authorized to play