By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,502 Members | 1,878 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,502 IT Pros & Developers. It's quick & easy.

Error in calling external procedure

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
HY!

Ive 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 discussion thread is closed

Replies have been disabled for this discussion.