Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 declaring variables

Author  Topic 

Nitin
Starting Member

6 Posts

Posted - 2004-10-13 : 02:43:38
Hi All,
Can anyone tell me how i can accomplish the following in ORACLE.
I have created a function in oracle and i want to pass constants to that function
Can any one help

Declare @d datetime
Select @d = '9/1/2004'

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-10-13 : 10:50:24
search www.dbforums.com.....this is mainly a MS SQLServer site....
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-10-25 : 13:14:54
Here's a sample


CREATE OR REPLACE PACKAGE dba_Functions_Package
AS

-- ***********************************************************************
-- * System *
-- * *
-- * Description: Package is used to store all function required by *
-- * stored procedures *
-- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
-- * Modifications Log: *
-- * *
-- * User Date Description *
-- * -------- ---------- ------------------------------------------------*
-- * x002548 07/17/2001 Initial Version *
-- * *
-- * *
-- ***********************************************************************
-- ********** S T A R T - G L O B A L - D E C L A R A T I O N S **********
-- ***********************************************************************

Function InstrCount (strValue Varchar2
,strTarget Varchar2)
RETURN NUMBER;


END dba_Functions_Package;

/

CREATE OR REPLACE PACKAGE BODY dba_Functions_Package
AS
-- *********************************************************************
-- *** F U N C T I O N (InstrCount) D E C L A R A T I O N S *****
-- *********************************************************************

Function InstrCount (strValue IN Varchar2
,strTarget IN Varchar2)
RETURN Number
IS
numOccurs Integer := 0;
numReturn Number := -1;
BEGIN

While numReturn != 0 Loop
numReturn := Instr(strValue,strTarget,1,numOccurs+1);
If numReturn <> 0 Then
numOccurs := numOccurs + 1;
End If;
End Loop While;

RETURN(numOccurs);

EXCEPTION
WHEN OTHERS THEN RAISE;

End InstrCount;



END dba_Functions_Package;

/





Brett

8-)
Go to Top of Page
   

- Advertisement -