1 Reply Latest reply: Jul 4, 2012 4:46 PM by rp0428 RSS

    Help Executing this SP

    771751
      Hi, how can i execute this SP on ORACLE?
      create or replace
      PROCEDURE SP_DELOSI_VAL_M (strCompania in varchar2, strMarca in varchar2,curResultado in out varchar2 ) AS 
      BEGIN
        
       declare 
       intTmp  NUMBER(3,1);   
       intCodCompania NUMBER(3,1);  
       
        begin
               SELECT tb_gen_compania.ID  INTO intCodCompania  FROM tb_gen_compania WHERE (COD_CODIGO = strCompania); 
               dbms_output.put_line( 'intCodCompania'); 
               SELECT COUNT(*) INTO intTmp FROM tb_gen_marca WHERE (cod_compania = intCodCompania and cod_codigo = strMarca); 
                if intTmp != 0 then
                       SELECT tb_gen_marca.ID  INTO curResultado  FROM tb_gen_marca WHERE (cod_compania = intCodCompania and cod_codigo = strMarca); 
                      else
                       curResultado := '0';
                end if ;
               exception 
                when others then 
                 dbms_output.put_line( 'We encountered an exception!' ); 
        end;
      END SP_DELOSI_VAL_M;
        • 1. Re: Help Executing this SP
          rp0428
          >
          Hi, how can i execute this SP on ORACLE?
          >
          Just declare your variables and call the procedure
          SET SERVEROUTPUT ON SIZE 1000000
          DECLARE
            l_strCompania varchar2(20);
            l_strMarca varchar2(20);
            l_curResultado varchar2(20);
          BEGIN
            SP_DELOSI_VAL_M (l_strCompania, l_strMarca,l_curResultado);
              DBMS_OUTPUT.PUT_LINE('l_curResultado' || l_curResultado);
          END;
          /