Error Executing Stored Procedure in InterSystems Cache using SQL
I am experiencing an issue while executing a stored procedure in InterSystems Cache. Here’s the procedure I created
CREATE PROCEDURE Silk.sp_InsertRecord (
IN RecordDate TIMESTAMP,
IN UserName VARCHAR(50),
IN RecordType INT,
IN RecordID VARCHAR(50),
IN CategoryID INT,
IN ApprovalDate TIMESTAMP,
IN FileSize BIGINT,
IN WorkstationName VARCHAR(50)
)
BEGIN
INSERT INTO DummyRecords (
RecordKey,
FilePath,
RecordDate,
UserName,
RecordType,
RecordID,
CategoryID,
FileSize
)
VALUES (
'd4a4e44b-4b56-4a74-b7f5-e44716fa5a13',
'',
RecordDate,
UserName,
RecordType,
RecordID,
CategoryID,
FileSize
);
END
This creates an SP of Function type.
Issue:
I encounter the following error upon execution:
Namespace: SILK
Process: 29088
Error:
2024-10-17 12:25:54 [SQLCODE: <-400>:<Fatal error occurred>] [Cache Error: <<UNDEFINED>zspInsertObject+50^Silk.procspInsertObject.1 *%ROWCOUNT>] [Location: <SPFunction>] [%msg: <Unexpected error occurred: <UNDEFINED>%0Ao+3^Silk.procspInsertObject.1 *%mmmsqld(3)>]
However, when I execute the stored procedure without passing any parameters and hardcode the values directly, it executes without any errors. Then it usually creates a query type procedure.
Additional Information:
- I am new to Cache and not entirely sure why I'm getting this error.
- The stored procedure compiles without any syntax errors. This is just an example..
Can someone help me understand why this error is occurring and how I can resolve it? Any guidance on how to properly debug or fix this issue would be greatly appreciated.