passing ADO recordset to Oracle stored procedure

oracle United States
  • 17 years ago

    Hi,
        Can we pass a recordset from a VB application to a Stored Procedure
    written in Oralce. If any one has any idea about this please respond.
    I am using ADO 2.7, VB6 and Oracle 9i.


    Thank you in advance
    Mike


  • 17 years ago

    Not to my knowledge however, you can pass a delimited string and use a procedure to convert it into a cursor.
    Here is the code to create the package. This will return the cursor which you can loop through inside of your stored procedure.


    Hope this helps!




    CREATE OR REPLACE PACKAGE PkgStringparse AS
    TYPE varchar2
    table IS TABLE OF VARCHAR2(32767) INDEX BY BINARYINTEGER;
    PROCEDURE SP
    DELIMITER2TABLE
      ( strInput IN  VARCHAR2
      , tblOutput       OUT varchar2table
      , intTableSize     OUT INTEGER
      , strDelimiter       IN  VARCHAR2 DEFAULT ','
      );
    END Pkg
    Stringparse;
    /


    CREATE OR REPLACE PACKAGE BODY PkgStringparse AS
    PROCEDURE SP
    DELIMITER2TABLE
      ( strInput IN  VARCHAR2
      , tblOutput       OUT varchar2table
      , intTableSize     OUT INTEGER
      , strDelimiter       IN  VARCHAR2 DEFAULT ','
      )
    IS
      strProcess   VARCHAR2(32767) := strInput;
      intRcTableSize  PLS
    INTEGER := 1;
      tblRcOutput    varchar2table;
      intDelimPos PLS
    INTEGER := INSTR(strInput, strDelimiter);
      intDelimLen PLSINTEGER := LENGTH(strDelimiter);
    BEGIN
    NULL;
      WHILE intDelimPos > 0
      LOOP
        tblRcOutput(intRcTableSize) := SUBSTR(strProcess,1,intDelimPos-1);
        strProcess := SUBSTR(strProcess,intDelimPos+intDelimLen);
        intRcTableSize := intRcTableSize+1;
        intDelimPos := INSTR(strProcess, strDelimiter);
      END LOOP;
      tblRcOutput(intRcTableSize) := strProcess;
      tblOutput := tblRcOutput;
      intTableSize := intRcTableSize;
    END SP
    DELIMITER2TABLE;
    END Pkg_Stringparse;
    /

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”