Oracle中Decode()函數提示含義解釋: decode(條件,值1,翻譯值1,值2,翻譯值2,...值n,翻譯值n,預設值) 該函數的含義如下:IF 條件=值1 THEN RETURN(翻譯值1)ELSIF 條件=值2 THEN RETURN(翻譯值2) ......ELSIF 條件=值n THEN RETURN(翻譯值n)ELSE RETURN(預設值)END IF 1、比較大小select decode(sign(變數1-變數2),-1,
select *From dba_views;select *From user_views;desc dba_source;desc user_source;select text from user_source where name = 'Your pkg name' order by line;union可以去除重複記錄,而union all則不行.在oracle中如何調用預存程序?最好有具體程式碼範例!直接調用過程名就可以了如p_test1調用p_test2(asRet2 out
問題是:把職工資訊表中的職工姓名的姓改為另一個.如:把張某改為王某,只改姓而不改名字:update 表名 set 欄位名 = '王' || substr(欄位名,2,length(欄位名)) where 欄位名 like '張%';表名是recv,裡面有欄位no讓no欄位為遞增:create sequencestart with 1increment by 1;查詢所有使用者表及其相應欄位的類型:select *From
CREATE OR REPLACE PROCEDURE abcde(mgr in number)as type t_pubapplyrow is record( v_empno number(4), v_ename varchar2(10) ); v_mgr emp.mgr%type; type cur_test is ref cursor; emp_cur cur_test; v_var t_pubapplyrow;BEGIN v_mgr:=mgr; OPEN emp_
基本上用到的文法如下: a. 擷取單個的建表和建索引的文法 set heading off; set echo off; Set pages 999; set long 90000; spool DEPT.sql select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') from dual; select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;
刪除資料庫某個表中的一列alter table tablename drop clumn clumnname;因為需求的變更,所以,有要對資料庫中的一些欄位進行修改.查了下網路上在資料,欄位名稱是無法修改的.唯一的辦法,就是刪了再添加.如何修改oracle資料庫中表的結構(欄位的名稱、長、類型、是否為空白)?改類型、長度、是否為空白: alter table mytable modify (mycol varchar2(20) not
dbms_rls包的應用——實現資料庫表行級安全控制rls即row LEVEL security以kgis使用者登入建立rls實驗資料表並建立rls函數應用於某表進行測試C:\Windows\system32>sqlplus /nologSQL*Plus: Release 11.2.0.1.0 Production on 星期三 1月 30 10:19:59 2013Copyright (c) 1982, 2010, Oracle. All rights reserved.SQL>
oracle資料庫安裝好之後,scott之類的使用者預設情況下是被鎖住的,無法使用scott使用者登入資料庫。如何解鎖一個使用者呢,需要進入sqlplus中,執行如下命令: 1: SQL> ALTER USER username ACCOUNT UNLOCK; 如果要解鎖scott,就用scott代替上面的username部分。 同樣,還可以將一個使用者鎖住: 1: SQL> ALTER USER username ACCOUNT LOCK;
在要drop一個資料庫使用者時發現這個使用者已串連到資料庫,因此沒法直接drop掉這個使用者。使用 1: select * from v$session where username='USERNAME' and STATUS <>'KILLED'查看出要kill掉的session後,發現有近15個session。發現這樣一個個去kill,太慢了,就來了招狠的: 1: SELECT CONCAT('ALTER SYSTEM KILL SESSION
Oracle Database 10g Release 2 (10.2.0.1.0) Enterprise/Standard Edition for Microsoft Windows (32-bit)Thank you for accepting the OTN License Agreement; you may now download this software. Download the Complete Files 10201_database_win32.zip (655,02
有時候我們需要從SQL Server資料庫匯入一些表資料到Oracle資料庫。當資料匯入成功後卻發現按欄位進行查詢卻老是提示列不存在。這時就需要我們將表名和欄位名批量修改為大寫方式。預存程序如下:create or replace procedure PD_BATCHRENAMETOUPPERASmysql varchar2(1000);cursor cur is select table_name from user_tables where
一、安裝oracel10g client,必要時請使用administrator使用者登入系統後再安裝二、找到安裝目錄下的bin目錄,添加ASP.NET相關的使用者權限,之後重啟IIS,否則會報告:System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.三、因為IIS是64位,此時訪問Oracle會報告:Attempt to load Oracle client libraries