項目經理--嘿嘿

          ?????? ?現在公司招來的員工中,總是招進一些“空降兵”式的項目經理,這些項目經理不管它以前有什么
          樣的經驗,僅僅就項目實施來說,他們有太多的不知道了。在我心目中,一個項目經理不僅僅具備一定
          的溝通技巧還需要具備較強的技術修養和背景。
          ??????? 不否認,項目中的溝通是可以解決項目中的一些問題,但是說服客戶是需要“以理服人”,因為客戶
          不是傻子,他們需要了解為什么這項功能不能實現,為什么這項功能需要推后實現,在我的經驗中,項目
          中沒有什么是客戶提出問題,而僅僅通過項目經理的溝通就可以解決的。解決的方式往往是項目經理“無可奈何”的向客戶保證××××我們一定完成。惡夢開始了,軟件人員有需要不停的加班來滿足客戶那些毫無理由的需求了。
          ?????? 我認為項目經理在客戶的和項目組員眼中應該是一個技術高手的形象,只要這樣他所作的決定才具有一定的說服力,所安排的工作才具備一定的合理性。而不是那些一行代碼沒有些過,而僅僅花一些錢考一些什么pmp 之類的認證的人。由于缺乏客戶的信任,將導致客戶繞過項目經理,直接找技術人員去解決問題,這將導致項目的逐漸失控。
          ??????? 現在公司不知是怎么想的,招聘只是考慮有沒有意愿,有沒有pmp而不是從實際是否具備的能力。在項目中也不知多少是由于他們的無知造成工期的延誤,一點點問題,都要到處協調人去解決,很小的一個問題一來一去不知要耽誤多少時間,消耗多少資源。最后還頗為感慨的說,作項目經理太累了。其實這不是太累了,這是因為技術素養太低造成的。IT行業所具有的特點是高手和庸才 之間生產力的差距不僅僅是幾倍而是幾十倍,甚至是上百倍。
          ????? 不具備軟件開發背景的項目經理工作進度的安排僅僅是一個漂亮的project 圖表,不具備任何實際意義。由于沒有親身經歷過開發,他不可能了解軟件開發的全過程,不可能對項目進度有比較深入的控制。而是靠pmp 中過程控制的方式管理軟件的開發,這幾乎成了軟件項目開發一濟致命毒藥。因此軟件項目的延期甚至失敗則變成了必然。
          ????? 另外 沒有作過軟件人員的項目經理,在軟件人員的管理方面存在也存在問題。不了解技術人員所想
          的是什么,更不可能真正調動起技術人員的積極性。他們所做的僅僅是不停的催促軟件人員開發,其實這也不能怪他,因為在他的眼里,整個軟件開發是一個黑盒,他之所以急躁,是因為他覺的不可控。

          ??????? ?嗨 不說了,說了這么多,只不過是對外行人管內行人的一點點感慨。趁這自己還在軟件開發這個階段,多學習,多總結,為成為自己心目中的軟件的項目經理而努力。

          posted @ 2006-08-24 08:09 康文 閱讀(400) | 評論 (2)編輯 收藏

          c++泛型編程

          1 Standard Template Library (STL)主要有兩種組件構成,一時容器container 另一種組件是 操作
          ?這些容器類的泛型算法
          ?1 vector and list 是序列是容器
          ?2 map 是一對keyvalue 組合 3 set 其中僅含有key 我們對它驚醒查詢操作。主要是判斷某之是否存在其中。
          2 指針的算術運算
          ?當數組被傳遞給函數,僅有第一個元素的地址會被傳遞
          ?template <typename elemType>
          ?elemType * find(const elemType *array,int size,const elemType &value)
          ?{
          ?? if(!array||size<1)
          ??? return 0;
          ?? for(int i=0;i<size;i++)
          ?? {
          ????? if(array[i]==value)
          ?????? return &array[i];
          ?? }
          ?? /*
          ??? for(int i=0;i<size;i++,array++)
          ?? {
          ????? if(*array==value)
          ?????? return array;
          ?? }
          ?? */
          ?? return 0;
          ?}
          ?template <typename elemType>
          ?elemType * find(const elemType *first,const elemType *last,const elemType &value)
          ?{
          ?? if(!fist||!last)
          ??? return 0;
          ?? for(;first!=last;first++)
          ??? if(*first==value)
          ??? return first;
          ?? return 0;
          ?}
          ?由于vector 和array 相同,
          array[2] equals *(array+2) 2 指兩個elemType 單位
          ?由于vector 和array 相同,都是以一塊賴寧許內存存儲所有元素,所以我們可以使用和array 一樣的處理處理
          ?方式
          ?vector<string> svec
          ?find(&vec[],&svec[vec.size()].serch_value);
          3 了解Iterator
          ? 1 template<typename elemType>
          ? void display(const vector<elemType>&vec,ostream &os)
          ? {
          ???? vector<elemType>::const_iterator iter=vec.begin();
          ???? vector<elemType>::const_iterator end_it=vec.end();
          ???? for(;iter !=end_it;++iter)
          ???? {
          ?????? os<<"ite3r"<<endl;
          ???? }
          ? }
          ?? 2 find
          ?? template<typename IteratorTypes,typename elemType>
          ?? IteratorType
          ?? find(IteratorType first,IteratorType last,count elemType &values)
          ?? {
          ????? for(;first!=last;++first)
          ?????? if(value==*first)
          ???????? return first;
          ?? }
          ??????? return last;
          ?? const int siz3=9;
          ?? int ia[size]={1,2,3,4,5,6,7,8,9};
          ?? vector<int> vec=(ia,ia+size);
          ?? list<int> list=(ia,ia+size);
          ??
          ?? int *pia=find(ia,ia+size,3);
          ?? if(pia!=ia+size)
          ???? //find...;

          ?? vector<int>::iterator it;
          ?? it=find(vec.begin(),vec.end,1024);
          ?? if(it!=vec.end())
          ??? //find...

          ?? list<int>::iterator it;
          ?? it=find(list.first().list.end,4);
          4 所有容器的共同操作
          ?equality(==),assignment(=),empty(),size(),clear()
          ?begin() 返回一個iterator,只向容器的第一個元素
          ?end()?? 返回一個iterator,只向容器的最后?一個元素
          5 使用序列容器
          ?1 vector 和list 是兩個最主要的序列式容器 vector 式一塊連續的內存。取數據效率較高,但是存數據
          ?但是如果在任意位置插入或刪除數據,效率就比較低。(但是在最后一位添加和刪除數據效率都比較高)
          ?2 list 系以雙向連接來存儲內存,可以任意執行前進或后退操作,可以在任意位置安插或刪除數據。
          ?3 deque 以連續的內存存儲元素,但是deque 在最前端元素的安插和刪除操作更有效,末端相同
          ?4 #include<vector>
          ?? #include<list>
          ?? #include<deque>
          ?5 產生空的容器
          ?? list<string> slist;
          ?? vector<int> ivec;
          ?6 產生特定大小的容器,每個元素都以千默認的值作為初值
          ?? list<int> ilist(1024);
          ?? vector<string> svec(32);
          ?7產生特定大小的容器,并為每個軟速制定初值
          ? vector<int> ivec(10,-1)
          ? list<string> slist(16,'unassigned');
          ?8 int ia[9]={1,2,3,4,5,6,7,8,9};
          ?? vector<int> fib(ia,ia+8);
          ?9 根據某個容器產生新容器,復制軟來容器的元素,作為新容器的初值
          ? list<string> slist;
          ? list<string> slist2<slist>
          ?10 push_back(),pob_back() 在容器末尾進行安插和刪除操作。在deque和list可以用push_front
          ? 和pop_front 在最前面天加和刪除操作。
          ?11 fornt() 和back()可以取回最前和最后的值?
          ?12 iterator insert(iterator position,elemType value)將value 安插于position 之前,返回一個iterator
          ?指向被安插的元素
          ? list<int>ilist;
          ? list<int>:: it=ilist.begin();
          ? while(it!=ilist.end())
          ?? if(*it>=ival)
          ?? {
          ????? ilist.inert(it,ival);
          ????? break;
          ?? }
          ? if(it==ilist.end())
          ??? ilist.pushi_back(ival);?

          posted @ 2006-08-21 21:40 康文 閱讀(497) | 評論 (0)編輯 收藏

          hibernate 總結基礎

          1 java 類型,???????????? hibernate 類型?????? sql
          ? java .lang.String?????? string?????????????? varchar
          ? java.lang.String??????? text???????????????? Text
          ? int???????????????????? int????????????????? INT
          ? char??????????????????? character???????????? char(1)
          ? boolean???????????????? boolean????????????? bit
          ? byte[]????????????????? binary?????????????? blob
          ? java.sql.Date?????????? date???????????????? Date
          ? java.sql.Timestamp????? timestamp??????????? Timestamp (載數據庫中如果插入為null,數據庫系統自動插入為當前值)
          2 表述層--》業務邏輯層-》hibernate-》database
          3
          ? Configuration config=new Configuration();
          ? config.add(Customer.class);
          ? sessionFactory=conf.buildSessionFactory();
          ? Session session=sessionFactory.openSession();
          ? Transaction tx;
          ? try{
          ?? tx=session.beginTransaction();
          ?? tx.commit();
          ? }catch(Exception e){
          ??? if(tx!=null){
          ????? tx.rollback();
          ??? }
          ? }finally{
          ??? session.close();
          ? }
          4 數據庫存取blob 對象
          ?1
          ?? InputStream in=this.getClass().getResourceAsStream("photo.gif");
          ?? byte[] buffer=new byte[in.available()]'
          ?? in.read(buffer);
          ?? customer.setImage(buffer);
          ?2 byte[] buffer=customer.get.getImage();
          ?? File OutputStream fout=new fileOutStream("photo.gif");
          ?? fout.write(buffer);
          ?? fout.close();

          posted @ 2006-08-18 16:20 康文 閱讀(222) | 評論 (0)編輯 收藏

          esential c++ 學習筆記1--c++ 編程基礎.txt

          1 class 的定義,一般來說分為兩部分,其中一個是所謂的頭文件,用來聲明class 所提供的各種操作行為
          ? 另一個是文件,程序代碼文件,用來包含這些行為的實現內容。預使用class 不許在程序中含入其頭文件
          2 using namespace std
          3 template class 機制使程序員直到使用template class 時才決定真正的數據類別。先使用一個代名,
          ? 稍后才綁定至實際的數據類別
          4 Arrays 要定義array 我們必須指定array 的元素類型,名稱,并指定其尺度的大小
          ? array 的尺度必須是個常量表達式
          ? const int seq_size=18;
          ? int pell_seql seq_size=1;
          5 vector 必須首先含如vector 的頭文件。在角括號中指定其元素類型,其尺度則寫作小括號內,不一定
          ? 是常量表達式
          ? #include<vector>
          ? vector<int> pell_seq(seq_size);
          6 初始化數組和vector
          ? 1 初始化數組
          ?? int elem_seq[seq_size]={1,2,3,4} ;
          ?? int elem_swq[]={1,2,3,4};由編譯其根據初始值自動算出array 的值
          ? 2 初始化vector
          ?? 1) vector<int> elem_seq(seq_size);
          ????? elem_seq[0]=1;
          ????? elem_seq[1]=2;
          ????? .....
          ????? elem_seq[[17]==22;
          ??? 2) 利用一個以初始化的array
          ???? int elem_val[seq_size]={1,2,3,4}
          ???? vector<int>elem_seq(elem_val,elem_val+seq_size); 其中elem_val 為內存地址
          7 array 和 vector 的使用
          ?? vector 知道自己的大小,而array 不知道
          ?? for(int i=0;i<elem_seq.size();i++){
          ????? cout<<elem_seq[[i]<<'';

          ??? }
          8指針 指針為程序引入了一層間接性,我們可以操作指針(代表某特定內存地址),而不再直接操控對象。
          ?指針主要形成兩件事,可以增加程序本身的彈性,但同時也增加了直接操控對象時所沒有的復雜度
          ?1 int ival=1024
          ?? int *p=&ival; 其中*p 指int型對象的地址
          ?2 指針所具有的雙重性,既可以讓我們操控指針內含的內存地址,也可以讓我們操作指針所指定的對象值
          ?? pi? 指定pi所含有的內存地址
          ? *pi? 核定ival的值
          ?3 指針的提領(dereference)
          ? 如果pi 尋址到某個對象,則執行提領操作,如果pi 不指定任何對象,提領會導致未知的執行結果
          ? 一個為只想任何對象的指針,其內含地址為0,我們稱為null,任何指針都可以被初始話,或是令值為0
          ? if(pi&&...)
          ? 只有pi含一個非0值時,其結果為true
          ? vector<int> *pv=0;?
          ? const int seq_cnt=6;
          ? vector<int> *seq_addres[seq_cnt]={
          ??? &fibonacci,&lucas,&pell...
          ? };
          ? 一個指針數組,容量為seq_cnt,每個指針都指向vector<int>??
          ? 4 #include<cstdlib>
          ? rand(seed) 返回一個介于0和seed 之間的隨機數
          ? 5 對象指針
          ? if(!fibonacci.empty()&&....){
          ???? pv.empty()..
          ?? }
          9 文件寫
          ? 對文件的讀寫,首先的含入fstream
          ? #include<fstream>
          ? 1 ofstream outfile("seq_data.txt"); 如果文件不存在,產生一個文件,如果文件已經存在,這個文件
          ? 被開啟作為輸出只用,但是源文件中的數據會輸調
          ? 2 ofstream outfile("seq_data.txt",ios_base::app) 追加模式
          ? 3 oufile 為false 表示文件未開啟成功
          10 文件讀
          ? ifstream 將文件名傳人,如果文件未能開啟成功,ifstream 對象被核定為false ,如果成功,為true
          ? ifstream infile("seq_data.txt");
          ? int num_tries=0;
          ? int num_cor=0;
          ? if(!infile){
          ??? //由于某種原因,文件無法開啟
          ? }
          ? else
          ? {
          ?? string name;
          ?? int nt;
          ?? int nc;
          ?? while(infile>>name)
          ?? {
          ???? // 一旦讀到到文件尾,infile 尾false
          ???? // infile>>name>>nt>>nc? ,把文件 anna 24 19 分別讀到name,nt,nc 中
          ???? infile>>nt>>nc;
          ???? if(name==usr_name)
          ???? {
          ?????? //find hime
          ?????? count<<"Welcome back,"<<usr_name
          ??????????? <<"\nYour current score is" <<nc
          ??????????? <<" out of " <<nt<<"\nGood Luck"!\n";
          ??????????? num_tries=nt;
          ??????????? num_cor=nc;???
          ???? }
          ?? }
          11 同時讀寫同一個文件
          ? fstream iofile("seq_data.txt",ios_base::in|ios_base::app);
          ? if(!iofile)
          ?? ...
          ? else
          ? {
          ?? iofile.seekg(0); 將文件重新定位的文件的最末端
          ? }
          12
          ? #include<iostream>
          #include<string>
          using namespace std;
          //---------------------------------------------------------------------------

          #pragma argsused
          int main()
          {
          ?? string username;
          ?? cout<<"Please enter your name:";
          ?? cin>>username;
          ?? switch(username.size()){
          ???? case 0:
          ?????? cout<<"with no name";
          ?????? break;
          ???? case 1:
          ?????? cout<<"with one character";
          ?????? break;
          ???? default:
          ?????? cout<<"hollo ,"<<username<<endl;
          ?????? break;
          ?? }
          ??????? return 0;
          }
          13
          #include<iostream>
          #include<vector>
          #include<string>
          using namespace std;
          //---------------------------------------------------------------------------
          int main()
          {
          ? vector<int> ivec;
          ? string str;
          ? int val;
          ? while(cin>>val){
          ?????? ivec.push_back(val);
          ? }
          ? int sum=0;
          ? for(int i=0;i<ivec.size();i++){
          ????? sum+=ivec[i];
          ? }
          ? int average=sum/ivec.size();
          ? cout<<"sum of "<<ivec.size()
          ????? <<"elements "<<sum
          ????? <<"average "<<average<<endl;
          ??????? return 0;
          }
          14
          //---------------------------------------------------------------------------

          #include<iostream>
          #include<vector>
          #include<string>
          using namespace std;
          //---------------------------------------------------------------------------
          int main()
          {
          ?const int array_size=120;
          ?int la[array_size];
          ?int ival,icnt=0;

          ?while(cin>>ival&&icnt<array_size){
          ?? la[icnt++]=ival;
          ?}
          ?int sum=0;
          ?for(int i=0;i<array_size;i++){
          ?? sum+=la[i];
          ?}
          ?int average=sum/array_size;
          ?cout<<array_size
          ???? <<"\n"<<sum
          ???? <<"\n"<<average<<endl;
          }
          //---------------------------------------------------------------------------


          //---------------------------------------------------------------------------

          #include<iostream>
          #include<vector>
          #include<string>
          #include<fstream>
          #include<algorithm>
          using namespace std;
          //---------------------------------------------------------------------------
          int main()
          {
          ? ifstream in_file ("D:\inputfile.txt");
          ? ofstream out_file("D:\outputfile.txt");
          ? if(!in_file){
          ???? cerr<<"unable to open the inputfile" ;
          ? }
          ? if(! out_file){
          ???? cerr<<"unable to open the outputfile" ;
          ? }
          ? string word;
          ? vector<string> text;
          ? while(in_file>>word)
          ? {
          ???? text.push_back(word);
          ? }
          ? cout<<"unsort file";
          ? for(int i=0;i<text.size();++i)
          ? {
          ? cout<<text[i]<<" "<<endl;
          ? }
          ? cout<<"sort file";
          ? sort(text.begin(),text.end());// sort the vector
          ? for(int i=0;i<text.size();++i)
          ? {
          ? out_file<<text[i]<<" "<<endl;
          ? }
          }

          ?

          posted @ 2006-08-14 09:27 康文 閱讀(722) | 評論 (0)編輯 收藏

          oracle 結構設計

          1 條件分之語句
          ? 1 簡單條件判斷
          ? declare
          ?? v_sal number(6,2);
          ? begin
          ?? select sal into v_sal from emp
          ?? where lower(ename)=lower('&&name');
          ?? if v_sal<2000 then
          ??? update emp set sal=v_val+200
          ??? where lower(ename)=lower('&name');
          ?? end if;
          ? end;
          ?2 二重條件分支
          ? if v_comm<>0 then
          ????? .....
          ? else
          ???? ........
          ? end if;
          ?3 多重條件分支
          ? IF?? THEN
          ? ELSIF?? THEN
          ? ELSIF?? THEN
          ? ELSE
          ? END IF;
          2 case 語句
          ? 1 在case 語句中使用單一選擇符進行等值比較
          ??? declare
          ????? v_deptno emp.deptno%type
          ??? begin
          ????? v_deptno:=&no;
          ????? case v_deptno
          ???????? when 10 then
          ?????????? update emp...
          ???????? when 20 then
          ?????????? update ......
          ???????? else
          ????????? dems_out.put_line('不存在該部門');
          ????? end case;
          ??? end;
          ? 2 在case 語句中使用多種比較條件
          ??? declare
          ????? v_sal emp.sal%type
          ????? v_ename emp.ename%type
          ??? begin
          ???? select ename ,sal into vv_ename,v_sal
          ???? from emp where empno=&no;
          ???? case
          ?????? when v_sal<1000 then
          ???????? update emp set ...
          ?????? when v_sal<2000 then
          ???? end case;
          3 循環語句
          ? 1 基本循環
          ?? declare
          ??? i INT:=1;
          ?? begin
          ??? loop
          ???? insert into temp valuse(1);
          ???? exit when i=10;
          ???? i:=i+1;
          ??? end loop;
          ?? end;
          ? 2 while 循環
          ??? while i<=10 loop
          ????? insert into tem valuse(i);
          ????? i:=i+1;
          ???? end loop;
          ? 3for 循環
          ??? for i in reverse 1..10 loop
          ????? insert into temp values(1);
          ??? end loop;
          4 順序控制語句
          ? 1 goto
          ??? goto label_name;
          ??? loop
          ????? ...
          ????? goto end_loop;
          ??? <<end loop>>
          ???? dbms_output
          ?? 2 null 語句不會執行任何操作,并且會直接將控制傳遞道下一條語句
          ??? if v_sal<3000 then
          ????? update emp set .....
          ??? else
          ????? null;
          ??? end if;

          posted @ 2006-08-11 10:47 康文 閱讀(227) | 評論 (0)編輯 收藏

          訪問oracle

          在pl/sql 中只能直接嵌入sql,dml,以及事務控制語句,而不能嵌入ddl語句如create。。和dcl 語句如grant
          1 檢索單行數據
          ? 1 使用游標變量接受數據
          ? declare
          ??? v_ename emp.ename%type
          ??? v_sal?? emp.sal%type
          ? begin
          ??? select ename,sal into v_ename,v_sal
          ??? from emp
          ? 2 使用記錄變量接受數據
          ?? declare
          ??? type emp_record_type is record(
          ????? ename emp.ename%type,sal emp.sal%type
          ??? );
          ??? emp_record emp_record_type;
          ?? begin
          ??? select ename,sal into emp_record
          ??? from emp
          ? 3 嵌入 select 語句注意的事項:語句必須返回一條數據,且只能返回一條數據,否則回觸發例外,或顯示錯誤
          ??? 1) no_data_found
          ??? 2) too_many_rows
          2 操縱數據
          ? 1 插入數據
          ??? 1) 使用values子句插入數據
          ??? declare
          ???? v_deptno dept.deptno%type
          ???? v_dname? dept.dname%type
          ???? v_deptno:=&no
          ???? v_dname:=&name;
          ???? insert into dept(deptno,dname)
          ???? values(v_deptno,v_danme);
          ??? 2)使用子查詢插入數據
          ??? declare
          ???? v_deptno emp.deptno%type:=no;
          ??? begin
          ???? insert into employee
          ???? select * from emp where deptno=v_deptno
          ?? 3 更新數據
          ??? 1)使用表達時更新列值
          ??? declare
          ???? v_deptno dept.deptno%type:=&no;
          ???? v_loc dept.loe%type:='&loc';
          ??? begin
          ???? update dept set loc=v_loc
          ???? where deptno=v.deptno;
          ??? end;
          ?? 2) 使用子查詢更新列值
          ??? declare
          ???? v_ename emp.ename%type:='&name';
          ??? begin
          ???? update emp set(sal,comm)=
          ???? (select sal ,comm from emp where ename=v_ename)
          ???? where job=(select job from emp where ename=v_ename);
          3 sql 游標
          ? 1 sql%isopen 用于確定sql 游標是否已經打開。當在pl/sql 塊中執行select into ,update 以及delete 語句
          ??? 時oracle 會隱含的打開游標,并且在語句執行完之后會隱含的關閉游標。
          ? 2 sql/%found 用于確定sql 語句執行是否成功。
          ??? declare
          ?????? v_deptno emp.deptno%type:=$no;
          ??? begin
          ?????? update emp set sal=sal*1.1
          ?????? where deptno=v_deptno;
          ??? if sql%found then
          ?????? dbma_output.put_line('語句執行成功');
          ??? else
          ?????? dbms_output.put_line('not success')
          ??? end if
          ?? end
          ?? 3 sql%notfound
          ?? 4 sql%rowcount 用于返回sql 語句所作用的總計行數
          4

          posted @ 2006-08-09 11:23 康文 閱讀(149) | 評論 (0)編輯 收藏

          oracle 函數

          1字符函數
          ?1 ascII(char) 返回字符串首字符的ascII 碼
          ?2 chr(n) 將asccII 轉化成字符
          ?3 v_chr varchar2(10)
          ?begin
          ? v_char:=chr(56);
          ? dbms_output.put_line('ascII 碼 為'||v_chr);
          ?end;
          ?4 concat 該函數用于連接字符串,其作用余連接操作符|| 完全相同
          ?5 initcap(char) 用于將字符串中的每個字符大寫
          ?6instr(char1,char2) 該函數用于取得子串在字符串中的位置 select instr('morning','n') from ,,,
          ?7 length(char)
          ?8 lower(char)
          ?9 lpda(char1,n,char2) 該函數用于在字符串char1的左端填充字符串char2 ,直至字符串總長的為n,
          ?? v_lpas:=lpad('aaa',10,'*');---*******aaa
          ?10 ltrim 去掉字符串char1 左端所包含的熱乎字符
          ? select ltirm('morning','m') from dual
          ?11 replace('缺省值為10','缺省','默認')--默認值為10
          ?12 rpad rpad('aaa',10,'*')--aaa*******
          ?13 rtirm
          ?14 substr v_sub:=substr('morning',1,3)
          ?15 upper
          2 數值處理函數
          ?1 abs(),floor(),round(),power(),sort(),....
          3 日期時間函數
          ?1 add_months(d,n) 返回特定日期時間d 之后,的n個月所對應的日期
          ? v_date:=add_months(sysdate,-14)
          ?2 current_date select current_date from dual
          ?3 current_timestamp
          ?4 dbtimesone
          ?5 extract 從日期時間中取得所需要的特定數據
          ?select extract(year from sysdate) year from dual
          ?6 months_between(d1,d2) 返回日期d1 和d2 之間相差的月數
          ?7? next_day(d,char)
          4 轉換函數
          ?1 to_char()
          ?2 to_date()
          5 集合函數
          6 其它單行函數
          7 分組函數

          posted @ 2006-08-09 10:51 康文 閱讀(281) | 評論 (0)編輯 收藏

          oracle sql 語句

          1 檢索日期
          ?1 select birthday from ...使用的是日期的默認格式
          ?2 使用YYYY-MM_DD 格式 select to_char(birthday,'YYYY-MM-DD') from ..
          2 處理null值
          ?1 使用nvl函數處理null值:nvl 函數用于將null 轉變為實際值,其語法格式為nvl(exp1,exp2),如果exp1是null 則反會exp2,否則返回exp1
          ? select nvl(comm,0) as salary from
          ?2 使用nvl2 處理null :nvl2(exp1,exp2,exp3),如果exp1 是null 返回exp3,否則返回exp3,exp2 ,和exp3 不可以是long,并需要和exp1匹配
          3 連接字符:select eanme||'is a '|| job as "employee detail" form emp
          4 在where 中使用 日期值
          ? select * from hiredate>to_date('1982-01-01','YYYY-MM-DD')
          5 在where 子句中使用like
          ? select * from ename like 'S%'? select * from ename like '__A%'? select * from ename like '%a_%' 字符a為轉義符
          6 插入數據
          ?insert into emp(empno ,ename,job,hiredate)values(1234,'mary','clerk',to_datee('1983-02-02','YYYY-MM-DD'))
          ?insert into dept values(50,'train','boston')
          7 使用子查詢插入數據
          ?? 1 使用子查詢
          ?? insert into employee (empno,ename,sal,deptno,form emp where deptno=20);
          ?? 2 使用查詢執行直接轉載
          ?? insert /*+append*/ into employee (empno,ename,sal,deptno)
          ?? select ..............(大批量數據直接轉載時速度更快一些)
          8使用多表插入數據
          ? 1 使用all 操作符執行奪標插入
          ?? insert all
          ?? when deptno=10 then into dept10
          ?? when deptno=20 then into dept20
          ?? when job='clerk' then into clerk
          ?? else into other
          ?? select * from emp;
          ? 2 使用first 操作符執行多表插入L:如果數據已經滿足先前條件,并且已經被插入到某表,那么
          ?? 該行數據在后續插入中將不會被再次使用。即不會出現既插入到dept10 中又插入到 clerk 中的
          ?? 情況
          ?? insert first
          ?? when deptno=10 then into dept10
          ?? when deptno=20 then into dept20
          ?? when job='clerk' then into clerk
          ?? else into other
          ?? select * from emp
          9 更新數據
          ?? 1 update emp set job default where cname='scott'? 如果存在默認使用默認,否則使用null
          ?? 2 使用子查詢更新數據,可以減少網絡開銷
          ?? update emp set (job,sal,comm)= (select job,sal,comm from emp where ename='cmith')
          ?? where ename='scott'
          ?? 3 復制數據 update employee set deptno=7788 where job=(select job form emp where empno=7788)
          10 刪除數據
          ? 1 delete 使用delete 的時候只刪去數據,而不會釋放空間,可以回退
          ? 2 truncate table emp? 不僅刪除數據,而起回釋放空間,不可一回退
          11 使用事務控制語句
          ? 1 提交事務 commit
          ? 2 回退事務
          ??? 1 回退部分事務:savepoint a
          ??????????????????? rollback a
          ??? 2 回退全部事務? rollback
          ? 3 只讀事務,只允許運行查詢操作。可重復讀 set transaction read only
          ? 4 順序事務 set transaction isolation level serializable
          12 分組函數,作用于多行,一般情況下于group by 字句結合使用,在使用分組函數時,如果忽略了 groub by 則匯總所有的行
          ?? select max(sal),min(sal) from emp
          ?? select avg(sal),sum(sal) from emp
          ?? select count(*) form emp
          ?? select count(emp) from emp
          13 使用group by and having
          ?? 1 select deptno,avg(sal),max(sal) from emp group by deptno
          ?? 2 select deptno ,avg(sal),max(sal) from emp group by deptno having avg(sal)<2000
          ?? 分組函數只能出現在選擇列表,having 和order 中
          ?? 當選擇表包含有列表達式,和分組函數,那么這些列表和表達式必須出現在group by 字句中
          ?? 3 rollup 和cube 中 產生橫向縱向 的統計結果
          ??? 在使用rollup操作符時,在生成原有統計結果的基礎,還會生成橫向小計結果,在使用cube 操作
          ??? 符時,在軟有rollup 統計結果的基礎,還會生成縱向小計結果
          ??? select deptno,job,avg(sal) from emp group by rollup(deptnojob);
          ??? select deptno,job,avg(sal) from emp group by cube(deptnojob);
          14 連接查詢
          ?? 在使用連接查詢時,必須在where 子句中指定有效的連接條件。如果不指定連接條件,或者指定無效的連接條件
          ?? 那么會導致生成笛卡爾乘積。
          ?? 1 select e.name,esal, from emp e,dept d where e.deptno=d.deptno;
          ?? 2 自然連接:在同一張表之間連接查詢
          ??? select manager.ename form emp manager,emp worker
          ??? where manager.empno=worker.mgr and worker.ename='blanke'
          ?? 3 內連接由于返回滿足連接條件的記錄,而外連接則是內連接的擴展,還會返回不滿足的連接條件的記錄
          ?? 4 左外連接: 不僅返回滿足條件的所有記錄,而且還會返回不滿足連接條件的連接符左表的其它行
          ??? select a.name,b,ename from adpt a left join emp b on a.deptno=b.deptno
          ?? 5 右外連接? right join
          ?? 6 完全外連接 不僅返回滿足條件的所有行,而且還會返回不滿足連接條件的所有其它行
          ??? select a.dname,b,ename from dept a full join emp b on a.deptno=b.deptno
          15 子查詢
          ?? 1 單行子查詢 返回一行數據的子查詢語句
          ?? select ename,sal,deptno form emp where deptno=(select deptno from emp where ename='scott')
          ?? 2 多行子查詢,返回多行子查詢
          ???? 1) 使用in操作符
          ????? select ename ,job,sal,deptno from emp where job in
          ????? (select distince job from emp where deptno='10')
          ???? 2)在多行子查詢中使用all操作符
          ????? select ename,sal,deptno from emp where sal>all(select sal from emp where deptno='30')
          ???? 3)在多行子查詢中使用any操作符 任何一個結果即可
          ????? select ename,sal,deptno from em where sal>any(select sal from emp where deptno='30')
          ?? 3 多列子查詢
          ???? select ename,job,sal,deptno from emp where (deptno,job)=(select deptno,job from emp where ename='smith')
          ???? 1) 成對比較示例
          ???? select ename,sal,comm,deptno from emp where (sal,nvl(cpmm.-1)) in (select sal,nvl(comm,-1) from emp where deptno='30')
          ???? 2) 非成對比較
          ???? select ename,sal.comm,deptno from emp where sal_in(select sal from emp where deptno='30')
          ????? and nvl(comm,-1) in (select nvl) in (select nvl(comm,-1) from emp where deptno=30)
          ?? 4 相關子查詢
          ???? SELECT ENAME,JOB.SAL,DEPTNO FROM EMP FROM EXISTS(SELECT l FROM DEPT WHERE.......)
          16 在dml 中使用子查詢
          ?? 1)在insert 中使用
          ?? insert into employee(id,name,title,salary)
          ?? select ename,job,sal from emp
          ?? 2)update emp sset (sal,comm)=
          ??? (select sal,comm fromm emp where ename='smtp')
          ??? where job=(select job from emp where ename='smith')

          17 在ddl???
          ? 1 在create table 語句中使用子查詢
          ? create table new_emp(id,name,sql,jog,deptno) as
          ? select empno,ename,sal,job,deptno from emp
          18 合并查詢
          ? 1) union? 自動去掉集合中重復的行,定對第一列結果排序
          ?? select ename,sal,job from emp where sal>2500
          ?? union
          ?? select ename,sal,job from emp where job='manager'
          ? 2) union all 不會取消重復值
          ? 3)intersect 取兩個結果繼的交集
          ? 4) ninus 取兩個結果結的差集
          19 其它復雜查詢
          ?1 層次查詢

          posted @ 2006-08-07 18:15 康文 閱讀(408) | 評論 (0)編輯 收藏

          oracle 管理學習筆記2--oracle 系統工具

          1 oracle universal installer(OUI)
          ?used to install,upgrade,or remove software components and create a database
          ?./runInstaller(unix)
          ?Non-interactive installation using response files
          ?./runInstaller -responsefile myrewpfile -silent(用指定的安裝文件)
          2 OracleDatabase Configuration Assistant(DBCA)
          ? creaste a database ,configure database options ,delete a database,manage template
          3 Database Administrator Users
          ? Sys is the owner of the database data dictionary
          ? System is the owner of additional internal tables and views used by oracle tools
          4 Local DataBase Administrator
          ? create os user id
          ? create os group ora dba,ora fox dba
          ??????????? ora_oper,ora_fox_oper
          ? add os user id to ora_dba,group
          ? edit sqlnet file: slqnet.authentication_services=(nts)
          ? you can login in database
          ? conn / as sysdba
          5 User Password File Authentication(由于數據庫還沒有啟動,需要利用數據庫外面的如文件系統,或口令文件來管理具有特出權限的用戶)
          ? 1 create the password file using the password
          ? orapwd file='d:\oracle\ora90\database\pwd<sid>.ora' password=admin1 entries=10;
          ? conn sys/admin1 as sysdba
          ? 2 set remote_login_passwordfile to exclusice
          ?? 1 orapwd?
          ?? 2 edit inti parameter file remote_login_passwordfile to exclusive
          ?? 3 grant system to kang (最多只能授權orapwd 中 entries參數指定用戶用戶數,具有此特出權限)
          ???? revoke sysdba form kong
          ?? select * from V$pwfile_users(查看有多少用戶具有特出權限)
          6 sql/plus
          ? sqlplus /nolog? sqlplusw /nolog
          ? set autocommmit on
          ? set linesize 1000
          7 Oracle Enterprise Manager Architecture
          ? Oracle Management Server,repository ,agent ,oracle server
          ? oracle 獨立登陸,雖然能夠聯機oracle ,但是很多管理更能不能操作,如backup 等
          8 oem console
          ?? central launching point for all applications
          ?? can be run in thin mode(web) or as a fat client
          ?? can bu launched either standalone or through oracle management server
          ?????????

          posted @ 2006-08-07 10:36 康文 閱讀(192) | 評論 (0)編輯 收藏

          oracle 管理學習筆記1—— oracle 體系結構概論

          1 An oracle server consists of an oracle instance ans oracle database
          2 startup nomount????? (allocate physical memory)
          ? alter database mount (control file)
          ? alter database open? (data file and log file)
          3 instance memory strusture
          ?????????? background process
          ? database--data file
          ??????????? log file
          ??????????? control file
          4 an oracle instance
          ? is a means to access an oracle database
          ? alwary opens one and only one database
          ? consists of memory and process structures
          5 show sga
          ? select * from v$bgprocess;
          ? select * from where v$bgprocess where paddr<>'00'列出必須的后臺進程
          6 connection to an oracle instance consists of establishing a user connection and creating a session
          ?user process?? server process
          7 an oracle database is collection that is treated as a unti
          ? consist s of thress file types data file control file log file
          8 the physical structure of an oracle database is determined by the orpertion system file
          ? that provide the actual
          ?
          ?select * from v$controlfile(列出所有控制文件)
          ?select * from v$datafile?? (列出說數據文件)

          53
          ?select * from v$logfile??? (列出所有日志文件)

          9memory structure
          ?oracle menory structure consists of two menory areas known as
          ?sga and pga(程序全局區2)
          10 The SGA consists of several menory structures:
          ???? shared pool
          ???? Database buffer cache
          ???? redo log buffer
          ?there are two optional menory structure than can be configured within the SGA
          ??? large pool
          ??? java pool
          11 SGA
          ?? show parameter shared (列出系統全局區的參數設置)
          ?? show parameter db_cache(列出系統數據庫緩存參數設置)
          ?? SGA is dynamic an d sized using SGA_MAX_SIZE,調整各個部分值的總合不能超過SGA_MAX_SIZE
          ??
          ?? alter session set nls_lanage=american
          ?? alter system set db_cache_size=64m
          ??
          12 Share Pool
          ? Share pool is used to store the most recently executed SQL statement s and the the most recently
          ? used data definitions
          ??? it consists of two key performance related memory structure
          ???? -library cache
          ???? -Data dictionary cache
          ??? it sized by the parameter share_pool_size
          ??? alter system set share_pool_size=64
          13 libray cache
          ?? The libray cache stores information about the most recently used sql and pl/sql statement
          ????? 1)Enable the shreing of commonly used statments
          ??????? is managed by ta least recently used LRU
          ????? 2)consists of two structures
          ??????? shared sql area
          ??????? Shared Pl/SQL area
          ????? 3)Has its size determined by the shared pool sizing
          14 Data Dictionary Cache
          ? The data dictionary cache is a collection of the most recently used definitions in the database
          15 Database Buffer Cache
          ? 1)The database buffer cache stores copies of data blocks that have been retrieved form the data files
          ? 2)it enable great performace gains when you obtain and update data
          ? 3)it is managered through a LRU
          ? 4)DB_BLOCK_SIZE determines the primary block size
          ? 5)show parameter db (列出db 中所有的參數)
          ? 6)Consists of indepent sub-cache
          ??? db_cache_size
          ??? db_keep_cache_size
          ??? db_recycle_cache_size
          ? 7)Database buffer cache can by dynamically resize to grow or shrink using alter system
          ?? alter system set db_cache_xiae=96m
          ? 8)DB_CACHE_ADVICE can be set gater statistics for predictin different cache size behavior
          ??
          ?? alter system set db_cache_advice=on ?
          16 The redo log buffer
          ? The redo log buffer cache records all changes made to the database data block
          ? 1)its primary perpose is recovery
          ? 2)change record within are called redo entries
          ? 3)redo entries contain information to reconstruct or redo changes
          ? 4)size is defined by log_buffer
          17 large Pool
          ? the loarge pool is an optional area of memory in the SGA
          ? 1)it relivere the burden placed on the shared pool
          ? 2)this configured memory area is used for sesion memory(UGA) ,
          ?? i/o slavers and backup and restore operation
          ? 3) the large pool does not use an LRU list
          ? show parameter log_buffer
          18 Process Structure
          ? Oracle takes advantage of various types of
          processes:
          ? 1) User process :Started at the time a database user requests connection to the oracle server
          ? 2) Serer process connects to the oracle instance and is started when a user establishes a session
          ? 3) background process available when an oracle instance is started
          19 user process
          ?A suer process is a program that requests interaction with the oracle server
          ?? 1)it must first establish a connection
          ? 2) it does not interact directly with the oracle
          20 Server Process
          ? Aserver process is a program that directly interacts with the oracle server
          ?? 1)it fulfills call generate and returns results
          ?? 2) can bi dedicated or shared server
          21 DBWn write s when checkpoint, dirty buffers threshold reach, no free buffer,timeout ,tablespaxe
          ?offline,tablespacee read only ,table drop or turncate,tablspace begin backup
          22 LGWR write
          ?at commit,went one third full,when threre is 1mb of redo ,every 3 seconds ,before DBWn writes
          24 System Moritor,PMON
          25 Checkpoint
          ?? Responsible for signalling DBWn at checkpoints
          ?? Updating datafile header with checkpoint information
          26 Archiver ARCn
          ?optional background process automaticall archives online redo logs when ARCHIVELOG mode is set
          ?Preserves the record of all changes made to database
          27 Lpgoca; Structure
          ? The logical structure of the oracle architecture dictates how the physical space of a database is to be
          ? sued
          ? A hierarchy seists in this structure that consists of tablespaces ,segments ,extents and blocks

          posted @ 2006-08-07 10:35 康文 閱讀(580) | 評論 (0)編輯 收藏

          僅列出標題
          共7頁: 上一頁 1 2 3 4 5 6 7 下一頁 
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 镇康县| 宿迁市| 峨山| 綦江县| 八宿县| 三台县| 射洪县| 禹城市| 江永县| 大化| 正定县| 珠海市| 彭州市| 丽江市| 大方县| 乐昌市| 鹤山市| 镇江市| 大城县| 正蓝旗| 镇原县| 罗甸县| 武宣县| 淅川县| 宝应县| 水城县| 靖江市| 贺兰县| 黄石市| 尖扎县| 滁州市| 定结县| 阿巴嘎旗| 大邑县| 沙湾县| 翼城县| 广饶县| 东兰县| 九寨沟县| 永寿县| 祥云县|