Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6703111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:07:59+00:00 2026-05-26T07:07:59+00:00

I have one function in oracle i need to convert it into c# code

  • 0

I have one function in oracle i need to convert it into c# code
please help or tell me any links to do it.

create or replace
FUNCTION             "GETSEPARATEDSTRING"
(  pString        IN VARCHAR2
   ,pSeparator     IN VARCHAR2
   ,pReturnNumber  IN PLS_INTEGER
)
RETURN VARCHAR2
IS
 l_SearchString_FinPos           PLS_INTEGER :=0;
 l_SearchString_StartPos         PLS_INTEGER :=0;
 l_SearchString_Length           PLS_INTEGER :=0;
 l_SearchString_CurrentPos       PLS_INTEGER :=0;
 l_Return                        VARCHAR2(4000);

BEGIN
  -- expecting values as String Seperator String Seperator
  -- so if pReturnNumber = 2 then where are
  -- looking for seperators 2 and 1. If there is no seperator
  -- at the end of the string it is added before comparison,
  -- Will return a null if:
  --  The length of pString is > 4000
  --  The pSeparator has not been specified
  --  The pReturnNumber IS <= 0
  --  The pReturnNumber IS greater than the number of pSeparator + 1 and therefore we can't pick up a string
  --  There was an empty string at the position requested
  -- Strings are returned without pSeparator

  IF     LENGTH( pString || pSeparator ) <= 4000
  AND pSeparator                       IS NOT NULL
  AND pReturnNumber                  >  0
  THEN
     l_SearchString_FinPos        := pReturnNumber;

     l_SearchString_StartPos      := pReturnNumber - 1;

     -- Concat a seperator at the end of the string so at least we

     -- know there is one

     IF INSTR( pString, pSeparator, -1, 1) != ( LENGTH( RTRIM( pString )) - LENGTH( pSeparator ) + 1 )

     THEN

       -- There isn't one at the end so add it

       l_Return                     := pString || pSeparator;

       --DBMS_OUTPUT.PUT_LINE('Did not find seperator - ADDING');

     ELSE

       l_Return                     := pString;

       --DBMS_OUTPUT.PUT_LINE('FOUND seperator');

     END IF;

     -- Set the start position of where we will check to the

     -- the last position we found a pSeparator value.

     l_SearchString_CurrentPos    := l_SearchString_FinPos;

     -- Search for the next pSeparator position

     l_SearchString_FinPos        := INSTR( l_Return, pSeparator, 1, l_SearchString_CurrentPos );

     IF l_SearchString_FinPos != 0

     THEN

       IF l_SearchString_StartPos != 0

       THEN

         l_SearchString_CurrentPos  := l_SearchString_StartPos;

         l_SearchString_StartPos    := INSTR( l_Return, pSeparator, 1, l_SearchString_CurrentPos ) + 1;

       ELSE

         -- If we are looking for the first value then StartPos will = 0

         -- and cause INSTR to fail

         l_SearchString_CurrentPos := 1;

       END IF;

       l_SearchString_Length      := l_SearchString_FinPos - l_SearchString_StartPos;

       l_Return                   := RTRIM( SUBSTR( l_Return, l_SearchString_StartPos, l_SearchString_Length ), pSeparator );

     ELSE

       l_Return := NULL;

     END IF;

   END IF;

   RETURN l_Return;

EXCEPTION

WHEN OTHERS

THEN

  DBMS_OUTPUT.PUT_LINE( 'FUNCTION GetSeperatedString Captured Error: ' || SQLERRM );

  RETURN NULL;
END;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:08:00+00:00Added an answer on May 26, 2026 at 7:08 am

    I don’t see why you can’t convert it yourself? What is the problem? You even got a comment describing exactly what the function is doing.

    Do something like this:

    1. Convert the method signature and all local variables to C# ones.
    2. Lookup the documentation of INSTR to see if uses a zero-based index as string.IndexOf
    3. Do a straight conversion by looking at one line at a time
    4. Test the function
    5. Rename all variables to have C# names
    6. Refactor to take advantage of C#
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have if else condition in one function in oracle i need to convert
Say I have the following code: function One() {} One.prototype.x = undefined; function Two()
I have one function ParseHtmlTable(string htmlContent) . Now in that function I want to
I am developing a C# program, and i have one function that consumes too
I'm trying to get rid of floats in my functions. I have one function
I have a one-dimensional function minimizer. Right now I'm passing it function pointers. However
I have one method that opens a file and passes off to another function
I have one array. I want that array to retain its value between function
I have a win form that creates a site in IIS7. One function needs
Ok, I have one JavaScript that creates rows in a table like this: function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.