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。
- ››oracle 中 UPDATE nowait 的使用方法
- ››Oracle ORA-12560解决方法
- ››Oracle 10g RAC 常用维护命令
- ››Oracle如何在ASM中定位文件的分布
- ››Oracle的DBMS_RANDOM.STRING 的用法
- ››oracle 外部表导入时间日期类型数据,多字段导入
- ››Oracle中查找重复记录
- ››oracle修改用户登录密码
- ››Oracle创建删除用户、角色、表空间、导入导出等命...
- ››Oracle中登陆时报ORA-28000: the account is lock...
- ››Oracle数据库在配置文件中更改最大连接数
- ››Oracle中在pl/sql developer修改表的两种方式
更多精彩
赞助商链接