中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

第一次接觸Oracle存儲過程

發布時間:2020-06-17 18:15:18 來源:網絡 閱讀:462 作者:flyinglxr 欄目:關系型數據庫

CREATE TABLE STUDENT(
    ID NUMBER(10)  NOT NULL ,
    NAME VARCHAR2(10) ,
    SEX CHAR(1),
    AGE Number(3),
    CREATIONDATE  DATE,
    MODIFIEDDATE DATE,
    PRIMARY KEY (ID));
    
 --查詢數據
select * from student;



 --插入數據
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107001,'Liu','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107002,'Jack','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107003,'Robin','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107004,'Fuck','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107005,'Duck','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107006,'God','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107007,'Dog','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107008,'Bike','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107009,'Ella','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107010,'Make','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107011,'Cela','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107012,'MeLe','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107013,'LooK','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107014,'Jack','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107015,'EKK','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));
insert into student(id,name,sex,age,creationdate,modifieddate)
values(7023107016,'Jack','B',19,to_date('20160322','YYMMDD'),to_date('20160322','YYMMDD'));

select * from user_procedures where PROCEDURE_NAME='PRO_STUDENT';  

--存儲過程例子(計算學生總人數)

    CREATE OR REPLACE PROCEDURE PRO_STUDENT   
    AS  
    S_TOTAL NUMBER(10);   
    BEGIN  
     SELECT COUNT(*) INTO S_TOTAL FROM STUDENT;   
     DBMS_OUTPUT.PUT_LINE('學生人數:'||S_TOTAL);   
    END;  
    
    EXECUTE PRO_STUDENT;  

--統計女孩人數(帶輸入參數)
     --注意變量定義不能與表中變量相同
    CREATE OR REPLACE PROCEDURE PRO_GIRL_STUDENT(student_sex in CHAR)   
    AS  
    S_TOTAL NUMBER(10);   
    BEGIN  
     SELECT COUNT(*) INTO S_TOTAL FROM STUDENT s WHERE s.sex=student_sex;   
     DBMS_OUTPUT.PUT_LINE('學生人數:'||S_TOTAL);   
    END;  
    
    EXECUTE PRO_STUDENT;  
   

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

梁山县| 农安县| 汝南县| 连云港市| 十堰市| 临汾市| 清徐县| 和田县| 东兰县| 罗源县| 吴江市| 红桥区| 鹿泉市| 安化县| 博客| 千阳县| 东明县| 朔州市| 青海省| 定襄县| 合肥市| 冷水江市| 林西县| 普兰店市| 绍兴县| 鹿邑县| 英德市| 白朗县| 东安县| 衡山县| 淄博市| 泰宁县| 中西区| 绥宁县| 磐安县| 察雅县| 古丈县| 张北县| 德昌县| 乌兰察布市| 新宁县|