在命令行创建存储过程或函数,需先输入.后,再编写存储过程或函数的具体内容,命令如下所示:
sql> \.
Enter RAW SQL. No \, :, * commands.
End with a line containing only ".;" to send to database,
or only "." to store to edit buffer for editing or saving. -----------------------------------------------------------------------
raw> create procedure Sample_drs (inout drsnum integer)
modifies sql data dynamic result sets 2
begin atomic
declare curd1 cursor
for select * from drs1;
declare curd2 cursor
for select * from drs2 where drs2.a > drsnum;
set drsnum = drsnum +1;
open curd1;
open curd2;
end;
存储过程或函数编写完成后,按下回车键,输入.;即可。
raw> .;
took 23 ms.
sql>