摘要:
1 create or replace 2 procedure lbm_pro2 3 (str1 in varchar2) as 4 str2 varchar2(50); 5 begin 6 select 机身号 into str2 from 基本库 where 机身号=str1; 7 end lbm_pro2; 8 9 /*10 如果你要取返回值,必须定义游标,如果用游标返回取到的值,必须定义包,在包里写存储过程。11 你也可以用楼上的方法把数据写进另一张表,不过要记得每次调用时还把表删掉。12 create or replace procedure sp_get_users_byId(p. 阅读全文
摘要:
1 set serveroutput on 2 declare 3 A integer:=1; 4 B integer:=23; 5 I integer:=0; 6 begin 7 --循环结构 8 --注意:PL/SQL程序块中的变量时不区分大小写的 9 loop10 11 A:=A+1;12 if A=B then13 exit;14 else15 I:=I+1;16 end if;17 18 end loop;19 dbms_output.put_line('一共循环次数为:'||to_char(i));20 end; 阅读全文
摘要:
1 create or replace function lbm_fun12 (iID in number) 3 return varchar2--此处不能指定大小 4 is 5 strGPSSN varchar2(50);--此处需要指定大小(或者: emp.ename%type) 6 begin 7 select 机身号 into strGPSSN from 基本库 where 编号=iID; 8 return strGPSSN; 9 end lbm_fun1; 阅读全文