set serveroutput on
declare
pnum number:=1;
begin
for pnum in 1..10 loop
dbms_output.put_line(pnum);
end loop;
end;
declare
pnum number:=1;
begin
for pnum in 1..10 loop
dbms_output.put_line(pnum);
end loop;
end;
2018-01-11
set serveroutput on
declare
pnum number:=1;
begin
loop
exit when pnum>10;
dbms_output.put_line(pnum);
punm:=pnum +1;
end loop;
end;
declare
pnum number:=1;
begin
loop
exit when pnum>10;
dbms_output.put_line(pnum);
punm:=pnum +1;
end loop;
end;
2018-01-11
set serveroutput on
declare
pnum number:=;
begin
while punm<=10 loop
dbms_output.put_line(pnum);
pnum:= pnum +1;
end loop;
end;
declare
pnum number:=;
begin
while punm<=10 loop
dbms_output.put_line(pnum);
pnum:= pnum +1;
end loop;
end;
2018-01-11
set serveroutput on
accept num prompt ''请输入一个数字;
declare
pnum number:=&num;
begin
if pnum = 0 then dbms_output.put_line('您输入的数字是0');
elsif pnum =1 then dbms_output.put_line('您输入的是1');
elsif pnum =2 then dbms_output.put_line('您输入的是2 ');
else dbms_output.put_line('其他数字');
end if;
end;
accept num prompt ''请输入一个数字;
declare
pnum number:=&num;
begin
if pnum = 0 then dbms_output.put_line('您输入的数字是0');
elsif pnum =1 then dbms_output.put_line('您输入的是1');
elsif pnum =2 then dbms_output.put_line('您输入的是2 ');
else dbms_output.put_line('其他数字');
end if;
end;
2018-01-11
set serveroutput on
declare
emp_rec emp%rowtype;
begin
select * into emp_rec emp where empno=7839;
dbms_output.put_line(emp_rec.ename||'的薪水是'||emp_rec.sal);
end;
declare
emp_rec emp%rowtype;
begin
select * into emp_rec emp where empno=7839;
dbms_output.put_line(emp_rec.ename||'的薪水是'||emp_rec.sal);
end;
2018-01-11
set serveroutput on
declare
pename emp.ename%type;
psal emp.sal%type;
begin
select ename,sal into pename,psal from emp where empno=7839;
dbms_output.put_line(pename||'的薪水是'||psal);
end;
declare
pename emp.ename%type;
psal emp.sal%type;
begin
select ename,sal into pename,psal from emp where empno=7839;
dbms_output.put_line(pename||'的薪水是'||psal);
end;
2018-01-11
declare
pnumber number(7,2);
pname varchar2(20);
pdate date;
begin
pnumber:=1;
dbms_output.put_line(pnumber);
pname:='Tom';
dbms_output.put_line(pname);
pdate:=sysdate;
dbms_output.put_line(pdate);
dbms_output.put_line(pdate+1);
pnumber number(7,2);
pname varchar2(20);
pdate date;
begin
pnumber:=1;
dbms_output.put_line(pnumber);
pname:='Tom';
dbms_output.put_line(pname);
pdate:=sysdate;
dbms_output.put_line(pdate);
dbms_output.put_line(pdate+1);
2018-01-11
set serveroutput on
declare
begin
dbms_output.put_line('Hello World');
end;
desc dbms_output
declare
begin
dbms_output.put_line('Hello World');
end;
desc dbms_output
2018-01-11
set serveroutoput on
declare
cursor cemp is select empname empjal from emp
pempno emp.empno% type;
pempname emp.empname%type ;
begin
--打开光标
open cmep ;
close cemp;
end;
/
declare
cursor cemp is select empname empjal from emp
pempno emp.empno% type;
pempname emp.empname%type ;
begin
--打开光标
open cmep ;
close cemp;
end;
/
2017-12-23