Professional Documents
Culture Documents
Delimiter//
Begin
Instrucciones;
Return valoradevolver;
End//
Delimiter;
Por Ejemplo:
delimiter//
begin
while num<=n do
Set fa=fa*num;
Set num=num+1;
end while;
return fa;
end//
delimiter;
Esta es una función a la cual le pasamos como argumento un número y nos retorna el
factorial de dicho numero.
if(txbnc.getText().trim().length()==0){
else{
try{
Ctrl.cn.cllst=Ctrl.cn.conec.prepareCall("{?=call Factorial(?)}");
Ctrl.cn.cllst.registerOutParameter(1,Types.INTEGER);
Ctrl.cn.cllst.setInt(2,Integer.parseInt(txbnc.getText()));
Ctrl.cn.cllst.execute();
int n=Ctrl.cn.cllst.getInt(1);
catch(Exception e){}