常见问题1000例Oracle(三)

2014-11-24 09:14:11 · 作者: · 浏览: 25
qu@infosys.com','i will become a rich man!');
insert into test_gary1 values(11,'gary','123','1000.00','garyqu@infosys.com','i will become a rich man!');
--inquiry record from table
select * from test_gary1;
--create oracle procedure
drop procedure gary_test1;
create or replace procedure gary_test1 (student_id in number,
student_name out varchar2
)
IS
--student_name:='kevin_xiong';
x number:=1;
Cursor cursor is select * from test_gary1;
--name varchar2(20);
i number:=0;
begin
if x>0 then
begin
DBMS_OUTPUT.put_line('holl world!');
DBMS_OUTPUT.put_line('holl baby!');
DBMS_OUTPUT.put_line('hello infosys!');
end;
end if;
for test in cursor LOOP
begin
DBMS_OUTPUT.put_line(test.id);
DBMS_OUTPUT.put_line(test.name);
DBMS_OUTPUT.put_line(test.password);
DBMS_OUTPUT.put_line(test.emailaddress);
DBMS_OUTPUT.put_line(test.introduce);
end;
end LOOP;
while i<20 LOOP
begin
DBMS_OUTPUT.put_line(i);
i:=i+1;
end;
end LOOP;
DBMS_OUTPUT.put_line(x);
end gary_test1;
----------reserch the record through the student id
create or replace procedure gary_test1 (student_id in number,
student_name out varchar2
)
IS
--student_name:='kevin_xiong';
x number:=1;
Cursor cursor is select name from test_gary1 where test_gary1.id=student_id;
--name varchar2(20);
i number:=0;
id number;
name varchar2(20);
begin
open cursor;
loop
begin
fetch cursor into gary_name
-- DBMS_OUTPUT.put_line(test.id);
DBMS_OUTPUT.put_line('teeesttt------stesrt');
-- DBMS_OUTPUT.put_line(test.password);