Advertisement
rauljrz

Mariadb, sp

Dec 5th, 2017
3,472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. _Bandera=0
  3. llError = SQLEXEC(lnHandle , "CALL `List_Edificios`('C0001', '1',  ?_Bandera)"
  4. llError = SQLEXEC(lnHandle , "SELECT @_Bandera;","crsSalida")
  5.  
  6. SELECT crsSalida
  7. BROWSE
  8.  
  9. CREATE DEFINER=`root`@`localhost` PROCEDURE `List_Edificios`(
  10.     IN `_XCod_edi` int(11) ,
  11.     IN `_modo` Varchar(1),
  12.     OUT `_Bandera` int(11)
  13. )
  14. LANGUAGE SQL
  15. NOT DETERMINISTIC
  16. CONTAINS SQL
  17. SQL SECURITY DEFINER
  18. COMMENT ''
  19. Begin
  20.     If  _modo = '1' Then
  21.         if EXISTS ( SELECT Cod_edi From Edificios Where ( Cod_edi =  _XCod_edi )  ) then
  22.                 Select Cod_edi, Nom_edi, Siglas_edi, Estatus_edi From Edificios Where ( Cod_edi =  _XCod_edi )  Limit 1;
  23.                 Set  _Bandera = 0;
  24.         Else
  25.                 Set  _Bandera = -1;
  26.         End if;
  27.     End if;
  28.     If  _modo = '2' Then
  29.                 Select Cod_edi, Nom_edi, Siglas_edi, Estatus_edi From Edificios  order by Cod_edi ;
  30.                 Set  _Bandera = 0;
  31.         End if;
  32. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement