Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a stored procedure which I c 1

Status
Not open for further replies.

NiteCrawlr

Programmer
Mar 16, 2001
140
BR
I have a stored procedure which I created on SQL SERVER:

**************
CREATE PROCEDURE [SP_EM_VERIF_NOVIS]
@EMPLID char(11),
@RESULTADO numeric(11) output
AS
Set @resultado = 0
IF Exists( Select [MANAGER_ID] FROM [PS_EM_ORG_NOVIS_VW] WHERE ([MANAGER_ID] = @EMPLID))
BEGIN
SET @RESULTADO = '1'
END
ELSE
BEGIN
SET @RESULTADO = '0'
END

RETURN @resultado
************

Which lines would I have to change so I can put it on a Oracle 8 DB?

Thanks
 
This ought to do:

FUNCTION SP_EM_VERIF_NOVIS( emplid IN VARCHAR2)
RETURN NUMBER;
IS
v_result NUMBER := 0;
BEGIN
Select Count(MANAGER_ID) INTO v_result FROM PS_EM_ORG_NOVIS_VW WHERE MANAGER_ID = emplid);
IF v_result >= 1 THEN
return 1;
ELSE
return 0;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
return 0;
END SP_EM_VERIF_NOVIS;
 
sorry!

The line
PS_EM_ORG_NOVIS_VW WHERE MANAGER_ID = emplid);
has a spurious ) and should read:
PS_EM_ORG_NOVIS_VW WHERE MANAGER_ID = emplid;
 
I'm sorry... but I also would like to know if these are the correct way to execute this stored procedure..... I'm executing it from an ASP page

Execute 1
*********
strSQL = "DECLARE @resposta numeric (11)"
strSQL = strSQL & vbCrLf & "EXEC SP_EM_VERIF_VISAO "&subresp&", @resultado = @resposta output"
strSQL = strSQL & vbCrLf & "select @resposta as param1"
Set vervis = objconexao.execute(strSQL)
*********
Execute 2
*********
set contsub(nivel) = objconexao.execute("SP_EM_COUNT_VISAO "& subresp)
totvisao(nivel) = contsub(nivel)("totalvis")
*********

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top