Oracle集合的first, last , next ,count,exist
DECLARE
TYPE typ_nums IS TABLE OF NUMBER INDEX BY PLS_INTEGER;
v_nums typ_nums;
v_index NUMBER;
BEGIN
v_nums(1) := 12;
v_nums(3) := 45;
v_nums(56) := 67;
dbms_output.put_line('v_nums.first = ' || v_nums.first);
dbms_output.put_line('v_nums.last = ' || v_nums.last);
dbms_output.put_line('v_nums.count = ' || v_nums.count);
IF v_nums.exists(6) THEN
dbms_output.put_line(' 6 exist');
ELSE
dbms_output.put_line(' 6 not exist');
END IF;
IF v_nums.exists(56) THEN
dbms_output.put_line('56 exist');
ELSE
dbms_output.put_line('56 not exist');
END IF;
v_index := v_nums.first;
WHILE v_index IS NOT NULL LOOP
dbms_output.put_line('v_nums(' || v_index || ') = ' || v_nums(v_index));
v_index := v_nums.next(v_index);
END LOOP;
END;
指令碼輸出是:
v_nums.first = 1
v_nums.last = 56
v_nums.count = 3
6 not exist
56 exist
v_nums(1) = 12
v_nums(3) = 45
v_nums(56) = 67
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8520577/viewspace-775427/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle集合型別的first、next、prior、last方法.TXTOracle型別AST
- plsql_index by_table of_count_next_prior_last,first語法小測SQLIndexAST
- OCP(11g)-----> oracle First In First Out (FIFO)/Last In First OutOracleAST
- Oracle分析函式-first_value()和last_value()Oracle函式AST
- 分析函式——NULLS FIRST/LAST函式NullAST
- [LeetCode] Find First and Last Position of Element in SortedLeetCodeAST
- 分析函式——keep(dense_rank first/last)函式AST
- Oracle in and existOracle
- 分析函式——FIRST_VALUE()和LAST_VALUE()函式AST
- oracle exists and not existOracle
- Leetcode 34 Find First and Last Position of Element in Sorted ArrayLeetCodeAST
- perl next, last, regular expression 實用場景ASTExpress
- first oracle sqlOracleSQL
- Oracle的LAST_DAY函式OracleAST函式
- MySQL的COUNT語句--count(*)、 count(常量)、 count(列名)MySql
- 解決busuanzi_count突然失效的方法(hexo-theme-next)Hexo
- 兩個SQL語句技巧——NULLS FIRST/LAST和分析函式版AVGSQLNullAST函式
- My First and My Last第一次與最後一次AST
- 前端常見bug系列1:容易被誤解的:last-child和:first-child前端AST
- count(1),count(*),count(列)的區別
- in與exist , not in與not exist 的區別
- ORACLE的count與空值比較Oracle
- count(*)、count(1)和count(列名)的區別
- 【Mysql】Last_Error: 1778 @@SESSION.GTID_NEXT == 'UUID:NUMBER'.MySqlASTErrorSessionUI
- Oracle not exist子查詢全掃的優化Oracle優化
- [Oracle Script] check object count by userOracleObject
- 關於 in與exist , not in與not exist 的區別
- Oracle 集合Oracle
- Oracle 的 INSERT ALL和INSERT FIRSTOracle
- count(0),count(1),count(*)總結與count(column)
- 【優化】COUNT(1)、COUNT(*)、COUNT(常量)、COUNT(主鍵)、COUNT(ROWID)等優化
- oracle count(expr)計算expr非空的和Oracle
- Oracle 集合操作Oracle
- First blog for Technology Of my own ,new world rules coming up next~
- 【Oracle】-【SORT AGGREGATE】-count與索引Oracle索引
- [程式設計題]查詢所有員工的last_name和first_name以及對應的dept_name程式設計AST
- count (*) 和 count (1) 和 count (列名) 區別
- count(*) 和 count(1)和count(列名)區別