如果我們的項目要從Oracle遷移到Mysql,但MySQL的instr函數只能尋找子串是否在父串中,沒法按照出現的次數進行尋找。這裡我自己寫了一個,以便遷移。當然我這裡僅僅針對的是遷移,可能沒有完全實現原有函數的細節。Oracle 裡用了幾次如下的調用,SQL> select instr('This is belong to you, but not to me.','to',1,1) as pos from dual;
系統內容 xp+.net2.0+oracle9i 表結構(由於是測試,表結構隨便建了一張) XX 欄位名 類型 ID VARCHAR2(70) TEST CLOB 測試 方式1:直接將CLOB的值拼字在SQL語句中。 代碼: string id = Guid.NewGuid().ToString(); OracleCommand cmd = Conn.CreateCommand(); cmd.CommandText = "insert into
1. ASCII 返回與指定的字元對應的十進位數; SQL> select ascii(A) A,ascii(a) a,ascii(0) zero,ascii( ) space from dual; A A ZERO SPACE --------- --------- --------- --------- 65 97 48
D:>set NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1 D:>set 直接打set命令可以查看環境變數 2、 在D:下建立a.sql檔案,內容如下: create or replace procedure test1(i in number) as begin dbms_output.put_line('輸入參數是'||to_char(i)); end; 3、 D:>wrap iname=a.sql
一 登入SQLPLUS sqlplus使用者名稱/密碼@資料庫執行個體as登入角色; 如:使用者sys(密碼為123)以sysdba的角色登入資料庫ORACL,我們可以輸入:sqlplus sys/123@oracl as sysdba; 這種登入方式會直接暴露密碼,如果想隱藏密碼,可以在此省略密碼的輸入,如:sqlplus sys@oracl as
sql server替換null:isnull(arg,value)如:select isnull(price,0.0) from orders ,如果price為null的話,用0.0替換與null比較: is not null,is null如 select * from orders where price is null ,price等於null如: select * from orders where price is not null