由於項目需要,需要尋找oracle表中的前幾條記錄,oralcle由一個rownum,可以直接用這個來得到需要的記錄數,但是一開始我用的sql是:select * from table where rownum< 你要查的記錄條數,雖然能夠取出前幾條記錄,但是我發現如果要把排序後記錄取前幾條結果就不對,即sql語句如下:select * from table where rownum<你要查的記錄條數 order by 欄位名 desc
SQL> startup ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/opt/oracle10g/product/10.2/db_1/dbs/initORA10G.ora' 尋找檔案,果然不存在。估計是非法關機造成的。
Oracle 中的Userenv() oracle userenv函數 、sys_context 用userenv 得到session id ,再串連v$transaction 串連v$session ,用session id 查當前事務號 select t.xid from v$transaction t join v$session s on t.ADDR = s.
第一個參數為'USERENV',是固定的,第二個參數也是固定的,但是是多選固定,可選的值如下所示: select sys_context('USERENV','AUTHENTICATION_TYPE') from dual;--使用者的認證類型 select sys_context('USERENV','AUTHENTICATION_DATA') from dual;--未知 select sys_context('USERENV','BG_JOB_ID') from
準備資料: drop table test purge;create table test(id number,code varchar(20),name varchar(20));insert into test values(1,'201401','aaa');insert into test values(2,'201402','bbb');insert into test values(3,'201402','ccc');insert into test values(4,'2014
--1、在PLSql或者navicat等資料庫用戶端工具管理員賬戶下:建資料表空間create tablespace DEMO_TABLESPACE logging datafile 'D:\Oracle\database\tablespace\demo.dbf' size 100M autoextend on next 100M maxsize 500M extent management local;--2、建立使用者並授權CREATE USER demo_usename