Subject RE: [firebird-support] Strange database issue - invalid request BLR
Author Svein Erling Tysvær
Don't know if it is relevant, but you use EXECUTE PROCEDURE when the procedure itself is a selectable procedure (due to SUSPEND). I suggest that you either change your call to SELECT R_ID FROM LOG_WRITE_PRC(:V_USER_ID,:A_IPADDRESS,'User ' ||
:A_LOGIN_ID || ' successfully logged in.', 'User ' || :A_LOGIN_ID || ' successfully logged in.'); rather than EXECUTE PROCEDURE or replace SUSPEND with EXIT.

Set

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Myles Wakeham
Sent: 21. november 2008 15:46
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Strange database issue - invalid request BLR

I have built a new Firebird 1.5.5 database on my laptop (running localhost
copy of SuperServer), which contains about 50% of the metadata from a
previous database that I built. I have used IBExpert to build this new
database, and have taken the DDL of various tables, stored procedures, etc.
from the old database and using the Script Editor in IBExpert, run that into
the new database.

I'm getting some strange issues periodically with the database. For
example, this just started to show up:

Running a stored procedure which was working perfectly and has been fine in
the past, started to give:

invalid request BLR at offset 872 parameter mismatch for procedure
LOG_WRITE_PRC

The stored procedure in question has an embedded EXECUTE PROCEDURE call in
it, that calls the LOG_WRITE_PRC procedure like so:

EXECUTE PROCEDURE LOG_WRITE_PRC(:V_USER_ID,:A_IPADDRESS,'User ' ||
:A_LOGIN_ID || ' successfully logged in.', 'User ' || :A_LOGIN_ID || '
successfully logged in.');

Where the number of parameters has not changed in the call, nor in the
receiving stored procedure.

I've run validation against this new database and it is not reporting any
issues. The error appears both in calling the stored procedure, but also
with any attempt to compile and commit the stored procedure into the
database.

The stored procedure that is executed is this:

CREATE OR ALTER PROCEDURE LOG_WRITE_PRC (
A_USER_ID INTEGER,
A_IPADDRESS VARCHAR(20),
A_SHORT VARCHAR(50),
A_LONG VARCHAR(127))
RETURNS (
R_ID INTEGER)
AS
DECLARE VARIABLE NEW_ID INTEGER;
begin
/* Writes a record to the AUDIT_LOG */
NEW_ID = GEN_ID(GEN_AUDIT_LOG_ID,1);

insert into AUDIT_LOG (
DA_ID,
DA_DATE,
DA_TEXT,
DA_IPADDRESS,
DA_TIMESTAMP,
DA_LOGDETAIL,
FK_USER_ID)
values(
:NEW_ID,
cast('NOW' as date),
:A_SHORT,
:A_IPADDRESS,
CAST ('NOW' AS TIMESTAMP),
:A_LONG,
:A_USER_ID);
for
select :NEW_ID from RDB$DATABASE INTO :R_ID
do
begin
suspend;
end
end^

SET TERM ; ^

GRANT INSERT ON AUDIT_LOG TO PROCEDURE LOG_WRITE_PRC;

GRANT EXECUTE ON PROCEDURE LOG_WRITE_PRC TO PROCEDURE USER_LOGIN_PRC;
GRANT EXECUTE ON PROCEDURE LOG_WRITE_PRC TO SYSDBA;

It executes without error manually, compiles fine, etc. I've even taken the
input parameters exactly as defined in the EXECUTE PROCEDURE call and ran
them through the IBExpert debugger, which succeeds without issue.

Can anyone point me towards understanding the error 'invalid request BLR at
offset 872 parameter mismatch for procedure LOG_WRITE_PRC' so I can find out
what is going on here?

Thanks in advance for any suggestions.

Myles