Search Algorithms in Oracle
What are the search algorithms that Oracle supports?
You use SQL to select from a database. You can find the Oracle SQL syntax documentation on tahiti.oracle.com
If you want to get down lower and find how the sql syntax is implemented, then some of this is documented on metalink.oracle.com in notes, and some is in books, and some is unknown ... (you could research your whole life ....)
If you need to ask this question, I think you should start with the basics of blocks, memory, processes, undo, redo etc.
Similar Messages
-
Creating A Binary search algorithm !!!! URGENT HELP
hi ..
i;m currently tryin to create a binary search algorithm ..
the user should be able to input the size of the array
and also the key that he would like to find.
it also has to have to ability to measure the run time of the algorithm.. it how long it too the algorithm to search through the array and find they key..
i have created 3 classes
the first class is the binary search class
which is the mathamatical side of things
the second class is the Array
this creates an array selection a random first number
and then incrementing from there, so that its a sorted array
the third class is the binary search class
which is my main class.
this class should take the users input
and pass it to the array
and the binary seach accordingly
it should also measure the running time, from when it passes the array
to the binary search class
i am having a really hard time creating this last class.
i have created the other 2 successfully
the codes for the binary search class is as follows
public class BinarySearch
static int binSearch(int[] array, int val)
// setting the start and the end of the array
int low = 0, high = array.length;
//While loop
while(low <= high) {
// How to find the mid point
int mid = (low + high)/2;
// if the mid point is the value return the value
if(array[mid] == val) {
return mid;
// if the value is smaller than the mid point
// go search the left half
} else if(array[mid] > val) {
high = mid - 1;
//if the value is greater then the mid point
// go search the right half
} else if(array[mid] < val) {
low = mid + 1;
// if value is not found return nothing
return -1;
}and the code for the Array class is as follows
import java.util.Random;
public class RandomSortedArray
public int[] createArray(int length)
// construct array of given length
int[] ary = new int[length];
// create random number generator
Random r = new Random();
// current element of the array; used in the loop below. Starts at
// -1 so that the first element of the array CAN be a 0
int val = -1;
for( int i = 0; i < length; i++)
val += 1 + r.nextInt(10);
ary[i] = val;
return ary;
}can some pne please help me create my binarysearchTest class.
as i mentioned before
it has to take the users input for the array size
and the users input for the value that they want to find
also needs to measure the running time
thanks for all ur help in advanceimport java.util.*;
public class AlgorithmTest
public static void main(String args[])
long StartTime, EndTime, ElapsedTime;
System.out.println ("Testing algorithm");
// Save the time before the algorithm run
StartTime = System.nanoTime();
// Run the algorithm
SelectionSortTest1();
// Save the time after the run
EndTime = System.nanoTime();
// Calculate the difference
ElapsedTime = EndTime- StartTime;
// Print it out
System.out.println("The algorithm took " + ElapsedTime + "nanoseconds to run.");
}this is the code i managed to work up for measuring the time..
how would i include it into the main BinarysearchTest Class -
Bind variable with search parameter in Oracle BI Publisher 10
Search list for a search parameter in Oracle BI EE works fine when the query doesn't contain a bind variable (parameter identifier). But when a bind variable is introduced in the constraint of search list query, it keeps on searching endlessly. For example,
-- this doesn't work
select col1
from table
where table.col2 = :I_param_bind_var
-- this works
select col1
from table
where table.col2 = 'xyz'
Using such bind variable in the list of values for menu parameters works fine. Is it an issue regarding publisher or am I missing something?
Edited by: 933296 on Aug 21, 2012 1:38 AM<?param@begin:Show_Location;'Yes';'string';'Yes,No'?>
it will give the Parameter Show_Loactaion with drop down Yes and No.
and to display <?$Show_Location?>
<?param@begin:dept;'PAY'?>
<?$dept?> -
Hey Guys,
I have written a crude search algorithm which extracts 4 fields from a database table into the String type of Java. Then this String object is tokenized and then within these tokens I search for the text the user has used.
Once, I faced this problem that one of the String pulled from the DB was so huge that I got the OutOfMemory exception. Simple stating it, the text was so big that my system could not store all that text in one String object.
I resolved this by adding more heap to java by doing:
java -Xmx512M MySearchClass
Now I am afraid that if there is another HUGE text in the DB , I can still run out of memory.
Do I just need to get MORE RAM to my system and allot really huge heap space, such as 4 GB or so , so that if need be, the JVM can use it ?
Suppose I get a server machine with 4 GB RAM, at some stage I'd still have an upper limit on the amount of text I can extract from the DB, right ?
Is there any other way to stream the text from DB and then search ? Remember that I am tokenizing the text in the algorithm, so I think I can't use a buffer, or can I ?
thanks a ton !
-AZThese are SQL queries. I use SQL queries to pull out the text in the DB and then store it in a String object. The problem is that the text in DB can get so huge that the String object cannot hold it anymore due to memory limits. The JVM gets assigned a heap size and the size of the String object can get really big to exceed the heap size.
I used : java -Xmx512M MySearchClass
That assigned 512MB to the JVM so I haven't encountered the OutOfMemory exception so far. But my guess is that for some other data set, the String can be so big that even 512MB might not be enough.
This search algorithm will be deployed on a server class machine with about 4 GB RAM. So we can give JVM 4GB heap space to use. But its a limitation again , right ?
These text in DB are extracted from PDF files. -
How to encrypt excel file data using triple DES algorithm in oracle
Hi,
I would like to know the process or script to encrypt/decrypt the excel file data using triple DES algorithm in oracle.I'm not quite sure your requirement.... do you mean when uploading files to be stored in the database ?
-
How fast text search field in Oracle without using Intermedia?
How fast text search field in Oracle without using Intermedia? Thank you, Paul.
yes,it is overriden in VOImpl
public void executeQuery()
setQuery((new StringBuilder()).append(selectStmt).append(" order by ").append(getOrderByClause()).toString());
OAApplicationModuleImpl oaapplicationmoduleimpl = (OAApplicationModuleImpl)getApplicationModule();
OAApplicationModuleImpl _tmp = oaapplicationmoduleimpl;
if(oaapplicationmoduleimpl.isLoggingEnabled(1))
OAApplicationModuleImpl _tmp1 = oaapplicationmoduleimpl;
oaapplicationmoduleimpl.writeDiagnostics((new StringBuilder()).append(getClass().getName()).append(".executeQuery").toString(), (new StringBuilder()).append(" Query:").append(getQuery()).toString(), 1);
super.executeQuery();
But I have extended VO and substituted the VO . In the substituted VOImpl, instead of executeQuery(),I have written
public void customExecuteQuery()
setQuery((new StringBuilder()).append(selectStmt).append(" order by ").append(getOrderByClause()).toString());
executeQuery();
Will this work,or do I need to do any changes?
Thanks, -
Java library for local search algorithms?
Hi everybody,
Could anyone please help me with the following?
I am looking for a Java library with already implemented local search algorithms. Does such a thing exist? Would anyone recommend one?
I am testing several AI programs and need to select the best parameters for each one (in a relatively large number of experiments). I could write my own search algorithm, of course, but it would be so much easier to use several already implemented algorithms and choose the best one.
Thanks in advance for any pointers.
AnnaHere is an interesting question. Say you build the central control system of a rocket ship using Java, should you then be able to ask questions about rocket ships in Java forums?
Well you can try, but I wouldn't hold your breath to find another rocket scientist in such a place. You may want to go to a forum where rocket scientists congregate in stead. Just a friendly tip. -
How search happens in oracle Database
Select emp_name from employee where salary > 10000;
How a search occurs in oracle database where there is a index in salary column and when there is no index in salary columnuser8850066 wrote:
i just want to know what happens internally to get the data.That is actually very complicated to answer. Oracle is a powerful and sophisticated piece of software, and what happens internally can vary based on configuration, data volume, and what else is happening. Books, papers and even entire conferences are dedicated to this question. Many myths abound, mostly from oversimplifications and improper assumptions about how Oracle works. The docs are good, but not so much for what is really happening internally.
It is good to be curious. As the others said, read the concepts manual, then read the performance guide and apply what you see to learn what is happening. As you learn more and more, you'll discover even many guru's consider the database a black box that we can only poke at and infer what is happening inside. Oracle does have a lot of instrumentation to see what is going on, but when it comes down to it, we're all still surprised at times about what must be happening.
I'd also recommend Tom Kyte's books, after you've digested the basics (some of which he wrote anyways). He has two great strengths: He explains what is happening clearly, and he shows you how to figure it out for yourself. Also Richard Foote's blog is excellent for the index half of your question, though it might be a bit much if you don't know the basic concepts.
As you read through the concepts, you'll realize your question has to account for things like:
Is it faster to get the data with one process or many?
Are other people modifying the data?
Do you want to get all the data as quickly as possible, or some of the data faster?
Do you know a better way to get the data than Oracle can figure out?
What are you going to do with the data when you get it?
What if the computer crashes while you are getting it?
What if the definition of the table changes while you are trying to get the data?
What if the data is far away?
What if someone doesn't want you to see it?
What if you also need to get some other data too?
All these and more can influence what Oracle does internally. On some basic level, you can say Oracle will do a full table scan or a modified b-tree index search, but beyond that, it can go nuts. -
Search form to Oracle PortalAS
hello,
what is the best and fast practice to create a search form to oracle portal..?If I read your requirements correct, you want end users to be able to search in data within database tables - right?
The search portlets will not help you in this case as they only search content in Oracle Portal, i.e. text items, file items etc. It will not go into the database and query tables.
If you only need to search one table, you might want to play around with a Portal report. You can personalize the report to allow end users to use conditional statements on each of the columns in your table. -
Hi..
I have to do some research about database searching algorithms.
Would someone here help me and give a list of that algorithms and which one is the best.
What is the name of this algorithms which when u type in a key such "a" then it display a list of information that started with "a".I guess I have more time than I thought... :)
Here is a full working example all in one class...
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MAIN
DefaultListModel model_my_list = new DefaultListModel();
JList my_list = new JList(model_my_list);
DefaultListModel model_list_of_finds = new DefaultListModel();
JList list_of_finds = new JList(model_list_of_finds);
JTextField search_box = new JTextField(20);
JTextField add_box = new JTextField(20);
public MAIN()
JFrame frame = new JFrame( "Search test" );
frame.setSize( 500, 500 );
Container container = frame.getContentPane();
GridBagLayout gbl = new GridBagLayout();
container.setLayout(gbl);
GridBagConstraints gbc = new GridBagConstraints();
Action actionAdd = new AbstractAction("ADD")
public void actionPerformed(ActionEvent evt)
model_my_list.add( model_my_list.size(), add_box.getText() );
add_box.setText("");
JButton buttonAdd = new JButton(actionAdd);
buttonAdd.setPreferredSize( new Dimension( 100, 30 ) );
gbc.gridx = 2;
gbc.gridy = 2;
gbl.setConstraints(buttonAdd, gbc);
container.add( buttonAdd );
Action actionSearch = new AbstractAction("SEARCH")
public void actionPerformed(ActionEvent evt)
search( search_box.getText() );
JButton buttonSearch = new JButton(actionSearch);
buttonSearch.setPreferredSize( new Dimension( 100, 30 ) );
gbc.gridx = 2;
gbc.gridy = 4;
gbl.setConstraints(buttonSearch, gbc);
container.add( buttonSearch );
JLabel add_label = new JLabel( "Add element" );
gbc.gridx = 1;
gbc.gridy = 1;
gbl.setConstraints(add_label, gbc);
container.add( add_label );
gbc.gridx = 1;
gbc.gridy = 2;
gbl.setConstraints(add_box, gbc);
container.add( add_box );
JLabel search_label = new JLabel( "Search keyword" );
gbc.gridx = 1;
gbc.gridy = 3;
gbl.setConstraints(search_label, gbc);
container.add( search_label );
gbc.gridx = 1;
gbc.gridy = 4;
gbl.setConstraints(search_box, gbc);
container.add( search_box );
JLabel all_label = new JLabel( "All elements" );
gbc.gridx = 1;
gbc.gridy = 5;
gbl.setConstraints(all_label, gbc);
container.add( all_label );
JScrollPane all_scroll = new JScrollPane( my_list );
gbc.gridx = 1;
gbc.gridy = 6;
gbl.setConstraints(all_scroll, gbc);
container.add( all_scroll );
JLabel found_label = new JLabel( "Searched elements" );
gbc.gridx = 2;
gbc.gridy = 5;
gbl.setConstraints(found_label, gbc);
container.add( found_label );
JScrollPane found_scroll = new JScrollPane( list_of_finds );
gbc.gridx = 2;
gbc.gridy = 6;
gbl.setConstraints(found_scroll, gbc);
container.add( found_scroll );
frame.pack();
frame.setResizable( false );
frame.setVisible( true );
public void search( String searchWord )
model_list_of_finds.clear(); //empty
for ( int i = 0; i < model_my_list.size(); i++ )
String text = (String)model_my_list.get(i);
if ( text.startsWith( searchWord ) )
model_list_of_finds.add( model_list_of_finds.size(), text );
continue;
if ( text.endsWith( searchWord ) )
model_list_of_finds.add( model_list_of_finds.size(), text );
continue;
String keyword[] = text.split( searchWord );
if (keyword.length > 1 ) //if there was a split... there was a find
model_list_of_finds.add( model_list_of_finds.size(), text );
continue;
public static void main ( String args[] )
new MAIN();
} -
How To Simplify Knowledge Search On My Oracle Support (MOS) For WCI (ALUI)
****** Please feel free to post a reply to this thread if you've found the link provided here useful ******
Where's The WCI Knowledge On My Oracle Support?
Have you been frustrated by how difficult it is to navigate the My Oracle Support "Product Tree" when searching for WebCenter Interaction knowledge articles?
Do you find yourself confused by the number of articles returned from your keyword searches for knowledge that have absolutely nothing to do with WCI Products?
Is there really any knowledge base for WCI products at all?
The answer is yes! In fact it's very healthy and getting healthier every day.
Across the breadth of the the WCI Products (Portal, Collab, Publisher, Analytics...etc.) there are hundreds of current and updated knowledge articles available on MOS.
New knowledge is created from almost every support case where the issue was not otherwise solved by existing knowledge or documentation.
The Support Team is reviewing and publishing an average of 20 new articles a month, each of them solutions culled from actual customer engagements.
We recognize that it can be difficult to navigate the "product tree" to narrow the scope of your search results to ensure it's limited to the knowledge created specifically for the WCI products.
To help make it easier for WCI customers to get to the right knowledge as quickly as possible we've created a valuable link to use anytime you want to search MOS for
WCI product knowledge. The link at the bottom of this posting will limit your search to only the products in the WCI family.
Let Us Know How We're Doing
Did an article help you resolve your issue and avoid having to log a service request?
Was the article perfectly written and exactly what you needed?
Was the article more complicated than it should have been or somehow incomplete?
Make sure you "rate" the article after viewing it and feel free to make comments to improve an article.
Look for the "Rate This Document" icon at the bottom of the view window for the article and click there.
The feedback goes directly to the team that created the article is actively reviewed in an effort to improve on the knowledge already provided
or to help generate new knowledge as needed. The Support Team is striving to ensure that the right information is available at the right time.
<h2>Click this link: WCI Search
The link should take you right to the WCI KM search section on MOS (after you log in) and all you need do from there is enter your key words and "Search".SUPER userful.
I attempted to use the Knowledge Base on oracle support earlier today to find this precise information and gave up in frustration.
This link definitely helps. -
Error on Basic search portlet in Oracle portal
I am working on Oracle 10g portal. I uploaded lot of documents and completed indexing as per Oracle guidelines. There are some errors during indexing.Out of 5000 documents 22 are not indexed. When I try to search from a page I get this error. This problem doesn't exist in our development environent where there are only few documents loaded. I have encountered errors in this environment also during index creation.
Appreciate your help.
Internal error (WWC-00006)
An unexpected error has occurred (WWS-32100)
Unknown Exception (WWC-45131)
User-Defined Exception (WWV-11230)
Unexpected error - ORA-20000: Oracle Text error:
DRG-10599: column is not indexed (WWC-35000)
----------------Hi,
What errors did you get during indexing?
-Ron -
Trying to Add a DFF Search criteria in Oracle Receivables (Customers HTML)
Hi Everyone,
I am trying to add a DFF search criteria within the Customer's HTML page. I was able to add the new message box, but am not sure how to tie the box to attribute 3 which is in the Receivables Party information Descriptive flex field. Oracle ebs r12.1.2 is the system.
Thanks for the help,
-MikeYes. It is possible through personalization.
1. Create a criteria row under Advance Search
2. Create a Result Item under advance table columns
3. Create a Query Criteria Map based on the criteria and result item above.
Please note the newly added criteria field should be in the Searchresults VO attributes list.
Otherwise you need to extend the VO as well.
Hope this helps.
Regards,
-Mukesh. -
Search with % in oracle text
How can i retrieve the records which has "80%" "and" keyword using oracle text . Because oracle consider " % , and , or " as the stopwords ... But i want to do the search on "80%" not "80" how to do that ....
below query retrieving both "80" and "80%" records....but i want only "80%"
SELECT ID, AUTHOR, DOCUMENT, PATH, PATH1
FROM DATASTORES_TAB a
WHERE contains ( dummy_col,'{80%}' ) > 0;Try this...
exec ctx_ddl.drop_preference('my_basic_lexer')
BEGIN
ctx_ddl.create_preference
preference_name => 'my_basic_lexer',
object_name => 'basic_lexer'
ctx_ddl.set_attribute
preference_name => 'my_basic_lexer',
attribute_name => 'printjoins',
attribute_value => '_%'
END;
drop table t1;
create table t1 (text varchar2(80));
insert into t1 values ('My example is 80% complete');
insert into t1 values ('This contains 80 without percent');
insert into t1 values ('This contains 801 without percent');
insert into t1 values ('Na%me1');
insert into t1 values ('Narme1');
CREATE INDEX t1_index ON t1 ( text )
indextype IS ctxsys.context
parameters ( 'lexer my_basic_lexer' );
select text from t1 where contains (text, '80%') > 0;
select text from t1 where contains (text, 'Na%me1') > 0;
select text from t1 where contains (text, '{80%}') > 0;
select text from t1 where contains (text, '{Na%me1}') > 0;
Output:
SQL> select text from t1 where contains (text, '80%') > 0;
TEXT
My example is 80% complete
This contains 80 without percent
This contains 801 without percent
Elapsed: 00:00:00.01
SQL> select text from t1 where contains (text, 'Na%me1') > 0;
TEXT
Na%me1
Narme1
Elapsed: 00:00:00.01
SQL> select text from t1 where contains (text, '{80%}') > 0;
TEXT
My example is 80% complete
Elapsed: 00:00:00.00
SQL> select text from t1 where contains (text, '{Na%me1}') > 0;
TEXT
Na%me1 -
How to execute exact match & contains text search simultaneoulsy in Oracle 10g
Hi,
We have scenario where there are more than 50 million rows in a table with description column length as 1000 character. We have a web interface from where we generate a rule of comma separated keywords like
"Standard", Single, Cancel, "deal" & so on. The words in quotes needs to be checked for exact match & the one without quotes will be searched using contains.
The problem is that we can have a rule of such a combination as large as 4000 characters of inclusion & 2000 such characters for exclusion (not to consider the description under exclusion) and this search when run on the table with millions of rows does not work using oracle regular expression, but works with smaller no. of search keywords.
Is there a better way to do such a kind of search in Oracle or if not then outside oracle using any other tool
Thanks,
APPlease find below the table script, few insert statements along with the SP & function. Please help.
-- Create Table
CREATE TABLE Roomdescriptionmaster
ID long,
ROOMDESCRIPTION nvarchar2, --- max 1000 charaters
Createddate datetime
----- Insert statements
INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Double Room (2 Adults + 2 Children) | FREE cancellation before Mar 16, 2014 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Double or Twin Room | FREE cancellation before Feb 1, 2014 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Quadruple Room (3 Adults + 1 Child) | FREE cancellation before Mar 16, 2014 PAY LATER Full board included [ Included:10 % VAT] Meals:Breakfast, lunch & dinner included.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Triple Room with Lateral Sea View (2 Adults + 1 Child) | FREE cancellation before Dec 6, 2013 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Single Room with Lateral Sea View | FREE cancellation before Dec 6, 2013 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
--SP
CREATE OR REPLACE PROCEDURE
SP_PGHGETROOMDESCRIPTION(v_BId number,
v_DaysOfData integer,
v_Incl1 nvarchar2,
v_Incl2 nvarchar2,
v_Incl3 nvarchar2,
v_Excl1 nvarchar2,
v_CurrentIndex integer,
v_RecordPerPage integer,
v_IndexMultiplier integer,
ref_recordset out sys_refcursor
) as
start_index integer;
end_index integer;
Incl1 nvarchar2(2000);
Incl2 nvarchar2(2000);
Incl3 nvarchar2(2000);
Excl1 nvarchar2(2000);
v_desc_utf_value VARCHAR2(10);
begin
v_desc_utf_value:= 'utf8';
if v_incl1 is null or trim(v_incl1) = '' then
--dbms_output.put_line('include 1 is null or blank');
Incl1 := '';
else
Incl1 := lower(v_Incl1);
end if;
if v_incl2 is null or trim(v_incl2) = '' then
--dbms_output.put_line('include 2 is null or blank');
Incl2 := '';
else
Incl2 := lower(v_Incl2);
end if;
if v_incl3 is null or trim(v_incl3) = '' then
--dbms_output.put_line('include 3 is null or blank');
Incl3 := '';
else
Incl3 := lower(v_Incl3);
end if;
if v_Excl1 is null or trim(v_Excl1) = '' then
--dbms_output.put_line('Exclude 1 is null or blank');
Excl1 := '';
else
Excl1 := lower(v_Excl1);
end if;
-- Old code
-- and regexp_like(lower(ROOMDESCRIPTION), Incl1, 'i')
-- and regexp_like(lower(ROOMDESCRIPTION), Incl2, 'i')
-- and regexp_like(lower(ROOMDESCRIPTION), Incl3, 'i')
-- and not regexp_like(lower(ROOMDESCRIPTION), Excl1, 'i')
--- First call to SP
if v_CurrentIndex = 1 then
start_index := v_RecordPerPage * v_IndexMultiplier;
end_index := (v_CurrentIndex - 1 + v_IndexMultiplier) * v_RecordPerPage;
open ref_recordset for
select * from (
select ROOMDESCRIPTION, Createddate, rownum as rn
from roomdescriptionmaster
where BID = v_BId
and TO_NUMBER(trunc(sysdate) - to_date(to_char(createddate, 'yyyy-mm-dd'),'yyyy-mm-dd')) <= v_DaysOfData
and length(FN_GET_RESTRICTION(lower(ROOMDESCRIPTION),Incl1,Incl2,Incl3,Excl1,v_desc_utf_value)) > 0
and row_num <= v_RecordPerPage * v_IndexMultiplier
order by row_num;
else
--- Subsequent calls to SP using paging from UI
start_index := (v_CurrentIndex - 1) * v_RecordPerPage + 1;
end_index := (v_CurrentIndex - 1 + v_IndexMultiplier) * v_RecordPerPage;
open ref_recordset for
select * from (
select ROOMDESCRIPTION, Createddate, rownum as rn
from roomdescriptionmaster
where BID = v_BId
and TO_NUMBER(trunc(sysdate) - to_date(to_char(createddate, 'yyyy-mm-dd'),'yyyy-mm-dd')) <= v_DaysOfData
and length(FN_GET_RESTRICTION(lower(ROOMDESCRIPTION),Incl1,Incl2,Incl3,Excl1,v_desc_utf_value)) > 0
order by roomdescriptionmasterid desc
where rn >= start_index
and rn <= end_index
order by rn;
end if;
commit;
end SP_PGHGETROOMDESCRIPTION;
--Function
CREATE OR REPLACE FUNCTION FN_GET_RESTRICTION(
v_rate_description IN NVARCHAR2,
v_include_1 IN NVARCHAR2,
v_include_2 IN NVARCHAR2,
v_include_3 IN NVARCHAR2,
v_exclude IN NVARCHAR2, v_desc_utf_value IN VARCHAR2)
RETURN NVARCHAR2
IS
CURSOR include_1_cur IS
select regexp_substr(str, '[^,]+', 1, level) str
from (select v_include_1 str from dual)
connect by level <= length(str)-length(replace(str,','))+1;
CURSOR include_2_cur IS
select regexp_substr(str, '[^,]+', 1, level) str
from (select v_include_2 str from dual)
connect by level <= length(str)-length(replace(str,','))+1;
CURSOR include_3_cur IS
select regexp_substr(str, '[^,]+', 1, level) str
from (select v_include_3 str from dual)
connect by level <= length(str)-length(replace(str,','))+1;
CURSOR exclude_cur IS
select regexp_substr(str, '[^,]+', 1, level) str
from (select v_exclude str from dual)
connect by level <= length(str)-length(replace(str,','))+1;
include_1_rec include_1_cur%rowtype;
include_2_rec include_2_cur%rowtype;
include_3_rec include_3_cur%rowtype;
exclude_rec exclude_cur%rowtype;
tmp_var NVARCHAR2(200);
tmp_var_int NUMBER;
tmp_flag_int NUMBER;
return_str NVARCHAR2(200);
tmp_length NUMBER;
tmp_length_include_1 NUMBER;
tmp_length_include_2 NUMBER;
tmp_length_include_3 NUMBER;
tmp_length_exclude NUMBER;
tmp_regex_pattern VARCHAR2(1000);
flag_include_1_match INTEGER;
flag_include_2_match INTEGER;
flag_include_3_match INTEGER;
flag_exclude_match INTEGER;
BEGIN
tmp_length_include_1 := nvl(length(v_include_1),0);
tmp_length_include_2 := nvl(length(v_include_2),0);
tmp_length_include_3 := nvl(length(v_include_3),0);
tmp_length_exclude := nvl(length(v_exclude),0);
flag_include_1_match := 0;
flag_include_2_match := 0;
flag_include_3_match := 0;
flag_exclude_match := 0;
IF tmp_length_include_1>0 OR tmp_length_include_2 >0
OR tmp_length_include_3 >0 OR tmp_length_exclude >0 THEN
IF v_desc_utf_value ='utf8' THEN
----------------------------------------------------- UTF 8 STARTED --------------
----------------------------------------- INCLUDE 1
tmp_length := tmp_length_include_1;
IF tmp_length > 0 THEN
tmp_flag_int :=0;
FOR include_1_rec in include_1_cur
LOOP
tmp_var := trim('' || include_1_rec.str);
--dbms_output.put_line(tmp_var);
tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
IF (tmp_var_int <> 0) THEN
tmp_flag_int :=1;
flag_include_1_match := 1;
EXIT;
END IF;
END LOOP;
ELSE
flag_include_1_match := 1;
END IF;
-------------------------------------------- INCLUDE 2
tmp_length := tmp_length_include_2;
IF tmp_length > 0 THEN
tmp_flag_int :=0;
IF flag_include_1_match =1 THEN
FOR include_2_rec in include_2_cur
LOOP
tmp_var := trim('' || include_2_rec.str);
tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
IF (tmp_var_int <> 0) THEN
tmp_flag_int :=1;
flag_include_2_match := 1;
EXIT;
END IF;
END LOOP;
END IF;
ELSE
flag_include_2_match := 1;
END IF;
-------------------------------------------- INCLUDE 3
tmp_length := tmp_length_include_3;
IF tmp_length > 0 THEN
tmp_flag_int :=0;
IF flag_include_2_match =1 THEN
FOR include_3_rec in include_3_cur
LOOP
tmp_var := trim('' || include_3_rec.str);
tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
IF (tmp_var_int <> 0) THEN
tmp_flag_int :=1;
flag_include_3_match := 1;
EXIT;
END IF;
END LOOP;
END IF;
ELSE
flag_include_3_match := 1;
END IF;
-------------------------------------------- EXCLUDE
tmp_length := tmp_length_exclude;
IF tmp_length > 0 and flag_include_3_match =1 THEN
FOR exclude_rec in exclude_cur
LOOP
tmp_var := trim('' || exclude_rec.str);
tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
IF (tmp_var_int <> 0) THEN
tmp_flag_int := -1;
return_str := '';
EXIT;
END IF;
END LOOP;
END IF;
ELSE
----------------------------------------------------- UTF 16 STARTED --------------
----------------------------------------- INCLUDE 1
tmp_length := tmp_length_include_1;
IF tmp_length > 0 THEN
tmp_flag_int :=0;
FOR include_1_rec in include_1_cur
LOOP
tmp_var := trim('' || include_1_rec.str);
--dbms_output.put_line(tmp_var);
tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
IF (tmp_var_int <> 0) THEN
tmp_flag_int :=1;
flag_include_1_match := 1;
EXIT;
END IF;
END LOOP;
ELSE
flag_include_1_match := 1;
END IF;
-------------------------------------------- INCLUDE 2
tmp_length := tmp_length_include_2;
IF tmp_length > 0 THEN
tmp_flag_int :=0;
IF flag_include_1_match =1 THEN
FOR include_2_rec in include_2_cur
LOOP
tmp_var := trim('' || include_2_rec.str);
tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
IF (tmp_var_int <> 0) THEN
tmp_flag_int :=1;
flag_include_2_match := 1;
EXIT;
END IF;
END LOOP;
END IF;
ELSE
flag_include_2_match := 1;
END IF;
-------------------------------------------- INCLUDE 3
tmp_length := tmp_length_include_3;
IF tmp_length > 0 THEN
tmp_flag_int :=0;
IF flag_include_2_match =1 THEN
FOR include_3_rec in include_3_cur
LOOP
tmp_var := trim('' || include_3_rec.str);
tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
IF (tmp_var_int <> 0) THEN
tmp_flag_int :=1;
flag_include_3_match := 1;
EXIT;
END IF;
END LOOP;
END IF;
ELSE
flag_include_3_match := 1;
END IF;
-------------------------------------------- EXCLUDE
tmp_length := tmp_length_exclude;
IF tmp_length > 0 and flag_include_3_match =1 THEN
FOR exclude_rec in exclude_cur
LOOP
tmp_var := trim('' || exclude_rec.str);
tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
IF (tmp_var_int <> 0) THEN
tmp_flag_int := -1;
return_str := '';
EXIT;
END IF;
END LOOP;
END IF;
END IF;
IF tmp_flag_int = 1 THEN
return_str := 'truely matched';
ELSE
return_str := '';
END IF;
ELSE
return_str := '';
END IF;
return return_str;
EXCEPTION
WHEN OTHERS THEN
--dbms_output.put_line('Exception');
RAISE;
END FN_GET_RESTRICTION;
Maybe you are looking for
-
Dear Friends, Is there a transaction or Report available to see the write-off stock by plant or through any movement types ? Please suggest the requirement is as fallows: Report needs to be selectable by IPC or ICC. Or plant The report will need to s
-
Moving Menus (video) and custom buttons
Hi guys, A very simple one I am sure but still can't find the right way to do it! I have a video BG for my menu, that I have created in After Effects. I am trying to add custom shaped buttons W alpha channels to the video BG. I have tried to import t
-
Can anyone tell me how I find my balance.. This is crazy.. Every turn I take I have to input my itunes identity.. Its ******** this should be soo complicated or am I just an idiot?? If I am fine!! I still need help!! LOL !! I've tried to make a pur
-
Spanish display incorrect after unicode conversion
Dear Experts, Currently we upgrade our SAP system from 4.6B NU to ECC6.0 UN. in 4.6B system we had implemented Simple Chinese and French language package to the system. after upgrade to ECC6.0 no-unicode system. we perform a MDMP unicode conversion.c
-
SQLException:refcursor value is invalid!What happened?
my database is oracle 9i recently when I execute a sql query by JDBC Connection conn = getConnection(); stmt = conn.createStatement(); stmt.setQueryTimeout(20); String sqlText = "select * from table"; ResultSet res = stmt.execute(sqlText);often cause