Want to know how to pass parameter in oracle sql query? we have a huge selection of how to pass parameter in oracle sql query information on alibabacloud.com
☆Retrieve all table names and column names of the databaseSelect name from sysobjects where xtype = 'U'Select name from syscolumns where id = (select max (id) from sysobjects where xtype = 'U' and name = 'table name ')☆Recursive Data QueryRecursive query of SqlServer2005 and Oracle in SQL statementsI used Oracle before
One: The value of the field of the query string type is NOT NULL for SQL:[SQL]View Plaincopy
SELECT * from tb_cms_flgtinfo_a t where (T.fsta are not null and t.fsta ');
Main: The above tb_cms_flgtinfo_a is the table name, Fsta is the field in the tableTwo: The query string Type field has a null value f
Different databases: oracle mysql SQL Server DB2 infomix sybase paging query statement, infomixsybase
Paging query statements used in different databases:
Current page: currentpagePage size: pagesize
1. Oracle Database
Select * from (select A. *, rownum rn from (QUERY_
Oracle multi-Table query, as its name implies, queries the data you want from multiple tables. Here we will test the emp table and dept table under the scott user. The structure of the two tables is as follows:SQL> select * from dept;DEPTNO DNAME LOC-------------------------------------10 ACCOUNTING NEW YORK20 RESEARCH DALLAS30 SALES CHICAGO40 OPERATIONS BOSTON
SQL
1 query statement 1.1 obtain the unique record -- distinct obtain the employee's unique salary status SQL statement is as follows. SQLgt; selectdistincte. employee_name,
1 query statement 1.1 obtain the unique record -- distinct obtain the employee's unique salary status SQL statement is as follows. SQLgt; select disti
ORACLE basic SQL statements-query, oraclesql statements
1. Common Query
/* Query table data */Select * from STU
/* Retrieve the first three rows of Data */Select * from stu where ROWNUM
/* Fuzzy query */Select * from stu where s
">
2. Merge into statement:
For the top statement, you can use the merge into statement
--Merge into implementation method
merge into EMP
using (SELECT * from
emp_new1
) E on
(e.empno = emp.empno)
when matched then
update set emp.empdesc = E.empdesc;The execution results are the same as the results in 1, assuming inference. It is recommended to use the merge into method.
Because merge into only visits once emp_new1.
Iii. Deleting delete op
Oracle Query result set, random sort
Copy Code code as follows:
SELECT * FROM table1 ORDER by Dbms_random.value ();
MySQL randomly query out a record:
Copy Code code as follows:
--The following query statement is efficient, do not use SELECT * FROM table1 to rand () LIMIT to
One of the Oracle-SQL skills (query continuous records) Requirement Description: www.2cto.com needs to query that a customer has been continuously performing business for those days of a year. The SQL implementation is as follows: Create a table: create table test_num (tyear
This article provides a detailed analysis of the implementation of Oracle SQL statements for querying and deleting jobs, for more information about how to query and delete duplicate records, see SQL statement 1. For more information about duplicate records in a table, see select * frompeoplewherepeopleIdin (selectpeopl
Tags: data SP problem BS database server SQL as installationWhen SQL Server accesses a database table in Oracle remotely:The remote syntax is typically: SELECT * from OpenQuery (Oracle linked server name, ' query statement ')Eg:select * from OPENQUERY (QTX, ' select * from s
The paging query method for Oracle, SQL, and DB2 is different from that for paging query statements in Oracle and SQL, the following describes the differences between DB2 paging query a
=address
andsql_hash_value=hash_value
/
11. View the parameter information of a data table
SELECTpartition_name,high_value,high_value_length,tablespace_name,
pct_free,pct_used,ini_trans,max_trans,initial_extent,
next_extent,min_extent,max_extent,pct_increase,FREELISTS,
freelist_groups,LOGGING,BUFFER_POOL,num_rows,blocks,
empty_blocks,avg_space,chain_cnt,avg_row_len,sample_size,
last_analyzed
FROMdba_tab_partitions
For a while, I was confused about Oracle multi-table queries. The reason is that Oracle's own syntax is mixed with SQL's international standard syntax. ThisArticleIt is only suitable for Oracle cainiao, and old birds fly directly... Multi-Table connection type (SQL 1999 standard)
•Cross joins
•Natural joins
•Using clause
•Full (or two-sided) Outer joins
My SQL is very poor, half a day response to, was a colleague joke. Oh, ah ah. Must surpass him later!!Table ShopPk_shop PRIMARY KeyName Commodity
Shop
Pk_shop
Name
001
Down
002
Coca - cola
Bpm_ll_test2
PK_BPM_LL_TEST2 PRIMARY Key
Sname Product Name
01
001
Select (select name from shop where shop s s.pk_shp
Many of my friends who use mysql limit for paging to oracle do not know how to write paging. In fact, oracle paging is similar to mssql paging. Next I will introduce oracle paging statements.
Simplest use
The Code is as follows:
Copy code
Select t2 .*From (select rownum r, t1. * from youtable t1 where rownum Where t2.r>?
If the numb
Copy codeThe Code is as follows:-- Oracle reads SQL statements from last Monday to weekend-- The day of the week starts on Sunday.Select to_char (to_date ('201312', 'yyyymmdd'), 'D') from dual;-- Result: Note 6: the sixth day of the week is Friday.Select to_char (sysdate + (2-to_char (sysdate, 'D')-7, 'yyyymmdd') from dual; --- last MondaySelect to_char (sysdate + (2-to_char (sysdate, 'D')-1, 'yyyymmdd') fr
,'YYYYMMDD') Rangebetween thePreceding Currentrow)End asf70115_70011, Case
whenA.c_date>To_char (sysdate-3,'YYYYMMDD')
Then
sum(VALUEF1) Over(Partition byA.code,a. Year Order byTo_date (A.c_date,'YYYYMMDD') Rangebetween thePreceding Currentrow)End asf70104_70011, Case
whenA.c_date>To_char (sysdate-3,'YYYYMMDD')
Then
sum(VALUEF6) Over(Partition byA.code,a. Year Order byTo_date (A.c_date,'YYYYMMDD') Rangebetween thePreceding Currentrow)End asf70126_70011, Case
whenA.c
Oracle Real-Time query resource consumption SQL 1. first, use the top command to view the pid Number with more resources in production. Note: For the oacle of the top Command user, follow the pid www.2cto.com 2. query the current time-consuming session ID, user name, And sqlID. Among them, the pid in top is the spid fi
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.