473,769 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\tes t\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 := '12345678123456 78';
which := 0;

-- SQL error at the following line!!!!!
-- "ORA-06525 Length Mismatch for CHAR or RAW data"
rvalue := SCRAMBLE(plaint ext,
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 4943
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.c om> schrieb im Newsbeitrag
news:cc******** *************** ***@posting.goo gle.com...
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\tes t\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 := '12345678123456 78';
which := 0;

-- SQL error at the following line!!!!!
-- "ORA-06525 Length Mismatch for CHAR or RAW data"
rvalue := SCRAMBLE(plaint ext,
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
4353
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
4278
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 experts here agree with the following? Would they add any other points? 1. If the shop standard calls for logging of application errors, a stored procedure should log any error that it encounters immediately upon detecting it and then return to the...
0
1530
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 calling the stored procedure from a Java program I am getting the following error: Exception: java.sql.SQLException: SQL0444N
5
2567
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 SQL DETERMINISTIC
6
4753
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 appreciated. Thanks in advance
16
2652
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 deciding how to respond. Does anyone know if this is possible.
2
3028
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 released, some thought must be put into how to make sure the objects will all be closed and released in the correct order, even in the result of an error. This requirement can make our code really ugly, even following the best of commonly known best...
13
4485
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 runs into problems on the system where it will actually be used, and since I used so little error-trapping it dies very ungracefully. I will of course try to fix whatever is causing the error and add error-trapping to the functions where the...
9
2103
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 app through code? I am using End for now. Is there a way I can suppress this exception message? The app gets invoked programmatically on a schedule. So no one would be around to click off the
5
3646
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 New System.Diagnostics.Process 'p.Start(MDEPDirStr & "macrun.exe", sPPTOut) p.Start("C:\WINDOWS\SYSTEM32\CALC.EXE") 'p.Start("C:\WINDOWS\SYSTEM32\macrun.exe", sPPTOut)
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.