473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Error in calling external procedure

Hi,

I am trying to call a C function from PL/SQL and I encounter
"ORA-06525 Length Mismatch for CHAR or RAW data". Following is the
information:

C function in util.dll:
INT Scramble(BYTE *input,
BYTE *key,
INT which,
BYTE *output);

I create the library and PL/SQL body using the following script:
CREATE OR REPLACE LIBRARY util
AS
'E:\Develop\test\util.dll';

CREATE OR REPLACE FUNCTION Scramble
(plaintext IN RAW,
key IN RAW,
which IN PLS_INTEGER,
ciphertext IN OUT RAW)
RETURN PLS_INTEGER
IS EXTERNAL
LIBRARY util
NAME "Scramble"
LANGUAGE C;

When I test the above function Scramble using the following PL/SQL, I
receive the error at the beginning of this message.

DECLARE
rvalue PLS_INTEGER;
plaintext RAW(8);
key RAW(16);
which PLS_INTEGER;
ciphertext RAW(8);
BEGIN
plaintext := '12345678';
key := '1234567812345678';
which := 0;

-- SQL error at the following line!!!!!
-- "ORA-06525 Length Mismatch for CHAR or RAW data"
rvalue := SCRAMBLE(plaintext,
key,
which,
ciphertext);
END;
Could anyone give me any idea what's wrong with the above code. Thank
you.

Cheers,
LTANG7
Jul 19 '05 #1
1 4885
HY!

I´ve never tried it with byte. But with char* and string it should work.
Otherwise you can try to change the in out prefix.

Ronny

"Lisa Tang" <lt****@yahoo.com> schrieb im Newsbeitrag
news:cc**************************@posting.google.c om...
Hi,

I am trying to call a C function from PL/SQL and I encounter
"ORA-06525 Length Mismatch for CHAR or RAW data". Following is the
information:

C function in util.dll:
INT Scramble(BYTE *input,
BYTE *key,
INT which,
BYTE *output);

I create the library and PL/SQL body using the following script:
CREATE OR REPLACE LIBRARY util
AS
'E:\Develop\test\util.dll';

CREATE OR REPLACE FUNCTION Scramble
(plaintext IN RAW,
key IN RAW,
which IN PLS_INTEGER,
ciphertext IN OUT RAW)
RETURN PLS_INTEGER
IS EXTERNAL
LIBRARY util
NAME "Scramble"
LANGUAGE C;

When I test the above function Scramble using the following PL/SQL, I
receive the error at the beginning of this message.

DECLARE
rvalue PLS_INTEGER;
plaintext RAW(8);
key RAW(16);
which PLS_INTEGER;
ciphertext RAW(8);
BEGIN
plaintext := '12345678';
key := '1234567812345678';
which := 0;

-- SQL error at the following line!!!!!
-- "ORA-06525 Length Mismatch for CHAR or RAW data"
rvalue := SCRAMBLE(plaintext,
key,
which,
ciphertext);
END;
Could anyone give me any idea what's wrong with the above code. Thank
you.

Cheers,
LTANG7

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Carlo Chung | last post by:
Hi, I have a question about how to retrieve the information of the calling instance, such as instance name, in an external C procedure. Thank you, Carlo Chung
0
by: Rhino | last post by:
I've written several Java stored procedures now (DB2 V7.2) and I'd like to write down a few "best practices" for reference so that I will have them handy for future development. Would the...
0
by: vaishaliekhar | last post by:
Hello, I have created a stored procedure using SPUFI. The stored procedure is defined to execute an external Assembler routine. There was no error while creating the stored procedure. While...
5
by: claus.hirth | last post by:
If I create the function HELLO in schema S01 as follows, @ CREATE FUNCTION S01.HELLO() RETURNS VARCHAR(32) EXTERNAL NAME 'UDFSRVXYZ!sayHelloWorld' LANGUAGE JAVA PARAMETER STYLE DB2GENERAL NO...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
16
by: Steve Jorgensen | last post by:
I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before...
2
by: Steve Jorgensen | last post by:
When writing VB or VBA code that works with databases or other external libraries that cannot be trusted to automatically do the right thing when references to their objects are arbitrarily...
13
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
9
by: Ron | last post by:
my application is throwing an exception error when closing if I run a procedure in the app. I can't even trap the error with try/catch ex As Exception. Is there a way to completely shut down the...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.