Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: ORA-06521: PL/SQL: Error mapping function

Re: ORA-06521: PL/SQL: Error mapping function

From: mukesh bhakta <mukesh_bhakta_at_hotmail.com>
Date: 9 Apr 2006 16:53:14 -0700
Message-ID: <1144626794.311506.88950@u72g2000cwu.googlegroups.com>


Thanks Sybrand and Vladimir for your inputs. I managed to get over that issue by including a return value of VARCHAR2 to the user and converting the procedure to a function. But I have to get over another hurdle. Here is what I am doing -

  1. VARCHAR2's can only send buffers <= 4000 characters. In my case it could be larger than 4000.
  2. I did some reading and found the RAW data type which maps to an unsigned char *.
  3. My C++ code does some thing like this
  4. Collects information from the call.
  5. Wraps the information into an xml.
  6. Sends the xml to the caller as a output variable type casted to unsigned char * which i guess is not enough for Oracle to interpret.

extern "C"__declspec(dllexport) unsigned char * shell(const char *cmd) {

    string fmt(cmd);
    fmt += " > c:\test.txt";

    int ret = system(fmt.c_str());

    // read the c:\test.txt and wrap the contents into an xml     return (unsigned char *) xml;
}

4. The stored proc is registered as follows -

create or replace procedure shell(cmd IN varchar2) return raw
as external
library shell_lib
name "shell"
language C
parameters (cmd string,
return raw);

I couldn't find much information on using RAW types with C external procs.

Any help/tips will be greatly appreciated.

Regards

MB Received on Sun Apr 09 2006 - 18:53:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US