Creating a stored procedure with one or more "update or insert" statement fails
-------------------------------------------------------------------------------

                 Key: CORE-3968
                 URL: http://tracker.firebirdsql.org/browse/CORE-3968
             Project: Firebird Core
          Issue Type: Bug
    Affects Versions: 3.0 Initial
         Environment: probably all (tested with Windows 7 and Ubuntu 12.04)
            Reporter: Frank Schlottmann-Goedde


Using the following script in isql against the employee database demonstrates 
the error

/*
Creating a stored procedure with one or more "update or insert" statement  
fails with:

Statement failed, SQLSTATE = 42S22
invalid request BLR at offset 193
-column EMP_NO is not defined in table PROJECT
-Error while parsing procedure EMPIU's BLR
*/

SET TERM ^ ;

create or alter procedure EMPIU (
    EMP_NO smallint,
    FIRST_NAME varchar(15),
    LAST_NAME varchar(20),
    PHONE_EXT varchar(4),
    HIRE_DATE timestamp,
    DEPT_NO char(3),
    JOB_CODE varchar(5),
    JOB_GRADE smallint,
    JOB_COUNTRY varchar(15),
    SALARY numeric(10,2),
    PROJ_ID type of column PROJECT.PROJ_ID)
as
begin
  select first 1 p.proj_id from project p where p.proj_id=:proj_id into 
:proj_id;
  update or insert into EMPLOYEE_PROJECT (EMP_NO, PROJ_ID)
  values (:EMP_NO, :PROJ_ID)
  matching (EMP_NO, PROJ_ID);

  update or insert into EMPLOYEE (EMP_NO, FIRST_NAME, LAST_NAME, PHONE_EXT, 
HIRE_DATE, DEPT_NO, JOB_CODE, JOB_GRADE,
                                  JOB_COUNTRY, SALARY)
  values (:EMP_NO, :FIRST_NAME, :LAST_NAME, :PHONE_EXT, :HIRE_DATE, :DEPT_NO, 
:JOB_CODE, :JOB_GRADE, :JOB_COUNTRY,
          :SALARY)
  matching (EMP_NO);
end^

SET TERM ; ^



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to