Like after% position does not go index problemcreate table t2 as select * from dba_objects;——创建表create index idx_t2_name on t2(object_name);——创建索引set autotrace on ——开启执行计划跟踪select * from t2 where object_name like ‘DE%‘;——走索引select * from t2 where object_name like ‘%DE‘;——不走索引Inconsistent query field type causes implicit conversions without indexing problemscreate table t3(id varchar2(10),name varchar2(10));——创建表t3insert into t3 select * from dba_objects;——插入数据commit; ——提交create index idx_t3_id o
When designing a database table, it was found that Oracle did not have a set of self-adding primary keys, and Google learned that Oracle itself does not support the Sequence key, which needs to be implemented through sequences (Trigger) and triggers.CREATE TABLE Student
Create Table Student (
ID number () primary key, the
name Varchar2 (
3)
that implements the ID by sequence and trigger, Sex
=spno;End-----3. How to call in Java---1. Create CallableStatement CS =ct.preparecall ([Call Sp_pro9 (?,?)]);----Cs.setint (1,10);----Cs.registeroutparameter (2,oracle.jdbc.oracletypes.cursor);--run--cs.execute ();--Get the result set/*resultset rs= (ResultSet) Cs.getobject (2);while (Rs.next ()) {....}*/---------------------Exception Handling---------Case_not_foundData_not_foundCursor_already_openDup_val_on_index Unique index repeatedInvaild_cursor run operation on an illegal cursor for
to reduce fragmentation, reduce index size, and improve query efficiency. when the text is deleted from the table, the Oracle text tag deletes the document, but does not immediately modify the index. As a result, the document information takes up unnecessary space, resulting in additional overhead for querying. You must optimize the index in full mode to remove invalid old information from the index. This process is called garbage disposal. Gar
Tags: Oracle data Import ExportOracle data Import Export BASIC Operations Example
Data exportA. Full export of database ORCL, username user password Password export to D:\dc.dmpExp User/[email protected] file=d:\dc.dmp full=yFull=y = Full Library exportB. Exporting User1 and user2 users in a databaseExp User/[email protected] file=d:\dc.dmp owner= (user1,user2)The full method backs up all user data
we have deleted the two tables, we can demonstrate the use of a cumulative incremental backup to recover the two tables, and then observe the process of cumulative incremental recovery:2.2 Cumulative Incremental RecoveryTo see if the table has been restored:3 differences between the twoVariance Increment:Cumulative increment:From the above experiment, differential incremental and cumulative incremental backups are not significantly different, and the cumulative incremental backup feature is tha
Tags: style blog color io os ar for SP divOracle cursor example, with exception handling.DECLARE CURSORC_dl is SELECTID, NSRSBH, Wspzxh, ZXYY_DM, Hzrq, SWJG_DM, GXSJ fromt_guos_zxxxWHEREGxsj>BEGIN_GXSJ; C_row C_DL%ROWTYPE; BEGIN forC_rowinchC_DL LOOPBEGIN IF(C_row. Gxsj>MAX_GXSJ) Then BEGINMAX_GXSJ:=C_row. GXSJ; END; END IF; Handled_count:=Handled_count+ 1; --MERGE intot_fr
The main is Query All_tables table table_name and owner, if the table exists, execute execute immediate ' drop tableTABLE_NAME ';
--Determine if the table exists, delete if present
DeclareNum number;BeginSelect COUNT (1) into NUM from all_tables where table_name = ' EMP ' and owner= ' SCOTT ';If Num=1 ThenExecute immediate ' drop table EMP ';End If;End
/--Create a table
CREATE TABLE EMP(EMPNO number (4) is not NULL,Ename VARCHAR2 (10),JOB VARCHAR2 (9),MGR Number (4),HireDate DATE,SAL Number
Attention:1. Assign Value: =2. Or the relationship is represented by orDeclarePrefix VARCHAR2 (2); --PrefixRes_value VARCHAR2 (20);BeginPrefix: = ' QZ ';For I in (select Col1,col2 from table_name) loopIf i.col1= ' col1 ' or i.col2= ' col2 ' thenRes_value: = ' 123456 ';End If;End Loop;Res_value: = SUBSTR (res_value,0,2); --intercepts the string starting from the first bit (0 and 1 representing the first digit) to intercept 2Dbms_output.put_line (Res_value); --Output statementEndFinal Output "12"
Tags: like rom oracle ref symbol space newline character value letterThe original in this poke Regexp_like 3 parameters The first one is the string entered The second one is the regular expression The third is the range of values: I: case is not sensitive; C: Case sensitive; N: Point number. Do not match line break symbols; M: multi-line mode; X: Extended mode, ignoring white-space characters in regular expressions. All test data Sql> SELECT * from T
Label:One, at the time of installation, the parameters are a bit different: Python setup.py Build Install Second, connect to the database, there are two ways, DSN and TNSNames way: # DSN = Orcl.makedsn (Self.oracle_host, Self.oracle_port, Self.oracle_sid)
#con = orcl.connect (self.oracle_username, Self.oracle_password, DSN)
con = Orcl.connect (self.oracle_username,self.oracle_password,self.oracle_alarm_ciname)
= con.cursor ()
" Select '%s ' from dual" % (test_str,)
cursor.execute (SQL);
=
intoTValues(i);8 Commit;9 EndLoop;Ten End; One /4. Batch commit.1 Create or Replace procedureproc_test2 as3 begin4 forIinch 1..1000005 Loop6 Insert intoTValues(i);7 EndLoop;8 Commit;--Batch Submission9 End;Ten /5. Write a SQL, which is inserted into a set concept by the original procedure, and a whole batch is written to the data buffer area.1 Insert into Select from by Level 1000000 ; 2 commit;6. Insert data in direct path mode, insert INTO T Select ... is to
');
Insert INTO te (ID, T_code, T_name, T_amount, T_dept, T_project, T_type)
VALUES (' 6 ', ' 6 ', ' 6 ', ', ' 2 ', ' + ' , ' 0 ');
3. Query full table View
[Java] view plain copy
select * from Te;
4. Use t.t_dept, t.t_project for group queries
SQL code[SQL]View PlainCopy
Select T.t_dept, T.t_project, sum (t.t_amount) from te T
Group by T.t_dept, T.t_project;
The results are as follows:5. Use T.t_dept, T.t_project, and t.t_dept t
Label:Problem:Check out the employee's name, job, and salary, which are higher than the salary of all sales staff.Analysis:Any can represent arbitrary, but this problem requires a higher salary than all salespeople, then use a different keyword all.All is used with the relational operator to represent comparisons with all elements in a subquery.Code Demo: All subqueries
/Code parsing:>all: Larger than all values in the subquery result, that is, larger than the maximum value in the subquery re
is declared and needs to be inserted before the BEGIN keyword: dynamic RESULT sets 1LANGUAGE sql*/create PROCEDURE a_test2 ( V_c VARCHAR (()) DYNAMIC RESULT sets 1LANGUAGE sqlbegin DECLARE t_sql VARCHAR2 (a); DECLARE t_a VARCHAR2 (); DECLARE t_b VARCHAR2 (); DECLARE t_c VARCHAR2 (); DECLARE t_d VARCHAR2 (); --The t_stmt behind the for is consistent with the following prepare variable, and its type is statement. DECLARE t_cur CURSOR with RETURN for t_stm
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.