WEB开发网
开发学院数据库Oracle Oracle Web应用开发之Apache架设与PL/SQL页面设计... 阅读

Oracle Web应用开发之Apache架设与PL/SQL页面设计

 2007-05-17 12:31:04 来源:WEB开发网   
核心提示: 1.建立表student并插入7条记录,CREATE TABLE student(IDNUMBER(5,0) NOT NULL,NAMEVARCHAR2(15) NOT NULL,DOBDATE,GENDERVARCHAR2(2) DEFAULT '男',CLASSYRNU

1.建立表student并插入7条记录。

CREATE TABLE student
(ID NUMBER(5,0) NOT NULL
,NAME VARCHAR2(15) NOT NULL
,DOB DATE
,GENDER VARCHAR2(2) DEFAULT '男'
,CLASSYR NUMBER(4,0) DEFAULT 2002 NOT NULL
,MAJOR VARCHAR2(25)
,EMAIL VARCHAR2(50)
,PHOTO VARCHAR2(100)
);
alter session set nls_date_format = 'dd-mon-yyyy';
alter session set nls_date_language = 'AMERICAN';
insert into student values ( 1001,'赵鹏','14-JUL-1975','男',2001,'History',
'1001@NetUniversity.org','u1001.gif')
/
insert into student values ( 1002,'刘宇','08-OCT-1975','女',2001,'Science',
'1002@NetUniversity.org','u1002.gif')
/
…………

2.以帐户cf/cf建立存储过程show_student。

create or replace procedure show_student
(p_id     in out student.id%TYPE
,p_name     out student.name%TYPE
,p_dob      out student.dob%TYPE
,p_gender    out student.gender%TYPE
,p_classyr    out student.classyr%TYPE
,p_major     out student.major%TYPE
,p_email     out student.email%TYPE
,p_photo     out student.photo%TYPE
)
IS
CURSOR get_student(p_id in student.id%TYPE DEFAULT 1001) IS
  SELECT * FROM student
  WHERE id = NVL(p_id,1001);
student_row student%ROWTYPE;
BEGIN
  IF p_id<1001 THEN
    p_id:=1001; 
  END IF;
  IF p_id>1007 THEN
    p_id:=1007;
  END IF;
  OPEN get_student(p_id);
  FETCH get_student INTO student_row;
  CLOSE get_student;
  p_name     := student_row.name;
  p_dob      := student_row.dob;
  p_gender    := student_row.gender;
  p_classyr    := student_row.classyr;
  p_major     := student_row.major;
  p_email     := student_row.email;
  p_photo     := student_row.photo;
END;
/

3.编写PSP网页,文件名为show.psp。

上一页  1 2 3 4 5 6 7  下一页

Tags:Oracle Web 应用开发

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接