select os.* from blis_order o,blis_orderservice os where o.orderid=os.orderid and o.ordertypeid not in (4, 8, 10, 11) and o.status in ('New','Accepted','Pending-ap 2.去掉重復(互異)的字段distinct
update offermigplan.db_table_name set entityid=?,keyid=?,subioncode=?,ordertypeid=?,type=?,templatecode=?,currencycode=?,exceptioncount=?,lastexception=?,att1=?,att2=?,att3=?,att4=?,att5=?,offercode=?,status=?,createdby=?,lastmodifiedby=?,lastmodifieddate=sysdate where bstoffermigplanid=?
12.插入數據量比較大的類型clob
13.查詢日期
下列兩條語句功能相同
select * from blis_account acc where to_char(acc.lastmodifieddate,'YYYYMMDD')>'20050101'
select * from blis_account acc where acc.lastmodifieddate>to_date('2005-01-01','yyyy-mm-dd')
select * from blis_usageaccess where chargeactivationid in (select chargeactivationid from blis_usageaccess group by chargeactivationid having count(*) >1)
select nvl(ob.bookingvalue,0) bookingvalue from blis_order o, blis_orderbooking ob where o.orderid=ob.orderid and o.orderid =125034 and ob.bookingtypeid = 215 and ob.status = 'Active'
select * from user_col_comments ucc where ucc.column_name = 'column_name'
比如: select * from user_col_comments ucc where ucc.column_name = ‘ORDERID’ 就會查出一系列有ORDERID字段的表。
17.遍歷兩字段排列
select (pf.offername || ' '|| cur.name) offercode from blis_packageoffer pf,blis_currency cur where cur.status='Active' and pf.status='Active'
結果如下:
offercode
a1 b1
a1 b2
a2 b1
a2 b2
18.條件判斷
case when pc.provisioningby = 'BPS' then 'True' else 'False' end
select sos.Sosorderserviceid, st.sosprovisionticketid, (case when pc.provisioningby = 'BPS' then 'True' else 'False' end) isConnector from blis_sosprovisionticket st, blis_sosorderform sof, blis_sosorderservice sos, blis_packagecomponent pc where sof.sosorderformid = sos.sosorderformid and sos.sosorderserviceid = st.sosorderserviceid and sos.status = 'Active' and st.status = 'Active' and pc.tagname(+) = st.servicetag and pc.provisioningby and sof.sosorderformid = 104789
19. pc.tagname(+) =st.servicetag
當pc.tagname存在值,st.servicetag不存在值的話,記錄也可以檢索出來。
20.讓表可以手工編輯
select rowid,st.* from blis_sosprovisionticket st where st.sosprovisionticketid=102508
查看所有表: select * from dba_all_tables 查看所有用戶: select * from all_users 查看所有DBA用戶:select * from dba_users 創建role :create role BLIS_ADMIN_ROLE; 創建新用戶:create user username identified by passWord 授予表空間使用權:grant resource to username 授予創建表權限:grant create table to username 授予連接數據庫的權限:grant create session to username 查看所有表空間: select * from dba_tablespaces 把任何表授予某用戶: grant create any table to BLIS_ADMIN_ROLE; 授予某用戶檢索功能:grant create any index to BLIS_ADMIN_ROLE; 授予某用戶對某表有檢索,插入,更新,刪除功能:grant select, insert, update, delete on BLIS_ACCAGENCYCOMMISSION to BLIS_ADMIN_ROLE;