×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Not quite sure where to ask this question. David let me know if it REALLY
doesn't fit here.
I am trying to create stored procedure that is called from .NET for the
purpose of reporting. I want the procedure to optionally accept 2
parameters. This is so I can return the either the full result set or just
information for a department/division. This is my first time really creating
one so I am sure it is a beginner error somewhere.
Here is the procedure I created:
DROP PROCEDURE qmfiles.sp_ServiceRequestStatus;
CREATE PROCEDURE qmfiles.sp_ServiceRequestStatus (IN deptCode CHAR(5), IN
divsCode CHAR(5)) LANGUAGE SQL BEGIN DECLARE sqlStatement CHAR(2048);
IF (deptCode <> ' ') THEN SET sqlStatement = sqlStatement || '(VDTCODE = "'
|| deptCode || '")'; END IF;
IF (divsCode <> ' ') THEN SET sqlStatement = sqlStatement || '(VDVCODE = "'
|| divsCode || '")'; END IF;
SET sqlStatement = sqlStatement || 'ORDER BY VDTCODE, VDVCODE, VCCODE,
SORTORDER';
EXECUTE sqlStatement;
END;
However, when I go to call it (CALL
qmfiles.sp_ServiceRequestStatus('IT','IT');) I get the following
error:
SQL State: 22001
Vendor Code: -303
Message: [SQL0303] Host variable *N not compatible. Cause . . . . . : A
FETCH, SELECT, CALL, SET, VALUES INTO, or GET DIAGNOSTICS cannot be
performed because the data type of host variable *N is not compatible with
the data type of the corresponding list item. -- When selecting a date
value, a character host variable must be at least 6 bytes for a Julian date,
at least 8 bytes for a date in the MDY, YMD, DMY formats, or at least 10
bytes for all other formats. -- When selecting a time value, a character
host variable must be at least 8 bytes for a time in the USA format and at
least 5 bytes for all other formats. -- When selecting a timestamp value, a
character host variable must be at least 19 bytes. -- If the host variable
is C NUL-terminated and the program was compiled with *CNULRQD option, then
an additional byte is required for the NUL-terminator for date/time values.
-- For GET DIAGNOSTICS ALL, the host variable must be varying length
character or varying length graphic. The relative position of the host
variable in the INTO clause, the SQLDA, or the CALL statement is -24064. If
the host variable name is *N, an SQLDA was specified on a FETCH statement.
Recovery . . . : Ensure that the data types are compatible for each of
the corresponding list items. Ensure the host variables are defined
correctly for date, time, and timestamp values.
Any ideas of what the problem is?
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.