Add data records in Asp.net+oracle and let ID automatically increment

Source: Internet
Author: User
Tags contains end key net table name

Adding data records in asp.net+oracle and having automatic ID increments requires sequences and triggers to be set in Oracle, remember not to index, ASP. NET regardless of ID, as follows:


1, establish the sequence:


CREATE SEQUENCE seq_emergency_id
Nocycle
MAXVALUE 9999999999
START with 2;


2. Set up triggers:


CREATE OR REPLACE TRIGGER set_emergency_id
Before INSERT on "emergency"
For each ROW
DECLARE
NEXT_EMERGENCY_ID number;
BEGIN
--get the next emergency ID from the sequence
SELECT seq_emergency_id. Nextval
Into next_emergency_id
from dual;


--use the sequence number as the primary key
--for the record being inserted
: new.id: = next_emergency_id;
End;


If created in Enterprise Manager, fill in the description of the trigger:


DECLARE
NEXT_EMERGENCYCB_ID number;
BEGIN
--get the next ID number from the sequence
SELECT seq_emergencycb_id. Nextval
Into next_emergencycb_id
from dual;


--use the sequence number as the primary key
--for the record being inserted
: new.id: = next_emergencycb_id;
End;


Common Oracle text text retrieval for your own summary


ORACLE text text retrieval: (first create a context or Ctxcat index, and then below) (you can also see the score of the retrieved items in the from SCORE (10))


1. Exact matching search of words


Select Cbid,title (column name) from emergency (table name) where contains (title, ' about ') >0; is to retrieve the Cbid and title fields containing the word "about" from title.


2. Exact matching of multiple words


Select cbid,title form emergency where contains (title, ' About and ask ') >0; is the above field that retrieves the word "about" and "instructions" from title.


You can also select Cbid,title form emergency where contains (title, ' About and ask ', NULL) >0; meaning ditto, not search phrase but two words, attention!


3. Exact phrase matching

Select Cbid,title (column name) from emergency (table name) where contains (title, ' Doctor visits ', NULL) >0; will exact match doctor visits phrase


If you want to use reserved words such as and,or,minus, you should use the escape character {}, such as Doctor {and} visits


4. Search for words that are close to each other


Select Cbid,title (column name) from emergency (table name) where contains (title, ' about NEAR instructions ') >0;
Select Cbid,title (column name) from emergency (table name) where contains (title, ' NEAR (For Instructions) ') >0; Refers to the specified two words within 10 words


5. Use wildcard characters in search (wildcard wildcard is%, Word wildcard wildcard is-)


Select Cbid,title (column name) from emergency (table name) where contains (title, ' worker% ') >0; is a word that retrieves the beginning of a worker, and the words are spread up to 3 characters.


6. Fuzzy Matching Search


Select Cbid,title (column name) from emergency (table name) where contains (title, '? About ') >0; (Add a question mark to the front)


7. Use the About operator to search the subject of a document


Select cbid,title form emergency where contains (title, ' About (housing) ', NULL) >0;


Note If the text index is not updated when the base table is updated with the context index, the Ctx_dll package should perform the Sync_index process as follows in order for the index to be synchronized:


EXECUTE Ctx_dll. Sync_index (' Review_index ');



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.