oracle-노트

3166 단어 oracle 노트
자세히 보기
 
--       :
1、        set timing on     sql  

2、      
  set serveroutput on;

3、     :
  alter system flush buffer_cache

4、     
  alter system flush shared_pool

--    
create or replace view xm_view001
 as
 select * from bureau_state
--     
select * from xm_view001

2.SELECT INTO STATEMENT
  -- select           ,               ,     
    ,      (        NO_DATA_FOUND)
    :
  BEGIN
  SELECT col1,col2 into   1,  2 FROM typestruct where xxx;
  EXCEPTION
  WHEN NO_DATA_FOUND THEN
      xxxx;
  END;
  ...

3.IF   
  IF V_TEST=1 THEN
    BEGIN
       do something
    END;
  END IF;

4.while   
  WHILE V_TEST=1 LOOP
  BEGIN
 XXXX
  END;
  END LOOP;

5.    
  V_TEST := 123;

6. for in   cursor
  ...
  IS
  CURSOR cur IS SELECT * FROM xxx;
  BEGIN
 FOR cur_result in cur LOOP
  BEGIN
   V_SUM :=cur_result.  1+cur_result.  2
  END;
 END LOOP;
  END;

7.    cursor
  CURSOR C_USER(C_ID NUMBER) IS SELECT NAME FROM USER WHERE TYPEID=C_ID;
  OPEN C_USER(   );
  LOOP
 FETCH C_USER INTO V_NAME;
 EXIT FETCH C_USER%NOTFOUND;
    do something
  END LOOP;
  CLOSE C_USER;

8. pl/sql developer debug
            Test WINDOW
         SP   ,F9  debug,CTRL+N    

9、    
  between 0 and 100

10、            
   delete from aaa a where rowid > (select min(rowid) from aaa b where a.name = b.name and a.id = b.id)

11、oracle   MD5  
   declare
      v_out Varchar2(300);
      v_str varchar2(30);
 begin
      v_str:='111111';
      v_out:=rawtohex(utl_raw.cast_to_raw(dbms_obfuscation_toolkit.md5(input_string =>v_str)));
      dbms_output.put_line(v_out);
 end;

12、oracle    
    create table test2  (col_1 char,col_2 char);

    insert into test2 values(1,2);
    insert into test2 values(1,3);
    insert into test2 values(2,4);
    insert into test2 values(2,5);

    select col_1,wmsys.wm_concat(col_2) col_2 from test2 group by col_1;


13.      sys.xmlType  
insert into person_extend
  (psn_code, PSN_XML)
values
  (1090019358,
   sys.xmlType.createXML('  xxxcfasf01dasdf421302198711161623[email protected]15013279494020-8330228210'))

좋은 웹페이지 즐겨찾기